请教如何用R读取无规律的文本文件
请问如何读取下面文件:
我其实只需要最后两行里面的4个数据,想把它们保存在一个向量或矩阵里面,因为有很多类似文件需要读取,但是每个文件中的行数均不一样,不知道如何提取需要的数据。还请达人指点,谢谢!
# 3PL estimation for single group
# Write output to log file
output -log_file CC_100.log
#The priors used in BILOG
options -default_prior_b {normal 0 2}
options -default_prior_a {lognormal 0.0 0.5}
options -default_prior_c {beta 6 16 0.0 1.0}
# the items to be modeled
allocate_items_dist 60 -num_groups 2
options -max_iter_optimize 2000
# Read examinee item responses from file
read_examinees Y_100.dat {@2 60i1} {i1}
# Compute starting values for item parameter estimates
starting_values_dichotomous
# Perform EM iterations for computing item parameter estimates.
# Maximum of 50 EM iterations.
EM_steps -max_iter 2000
print -latent_dist_moments
# Print item parameter estimates
write_item_param CC_100.par
# end of run
release_items_dist
----------------------------------------------------------------------
Number of items: 60
Number of latent variable points: 40
Number of examinee groups: 2
Default prior for a-parameters:
lognormal Mean: 0.000 s.d. 0.500
Default prior for b-parameters:
normal Mean: 0.000 s.d. 2.000
Default prior for c-parameters:
beta a: 6.000 b: 16.000 lower limit: 0.000 upper limit: 1.000
Read 3500 examinee records from file Y_100.dat
EM iterations
(iteration: parameter criterion, dist criterion, marginal posterior mode)
1: 0.333017 0.983328 -65310.6154
2: 0.076773 0.098140 -65295.6751
3: 0.029109 0.047026 -65290.6117
4: 0.016008 0.035879 -65287.7342
5: 0.014151 0.027880 -65285.8887
6: 0.012574 0.021876 -65284.6163
7: 0.010898 0.018541 -65283.6848
8: 0.009329 0.016498 -65282.9670
9: 0.007944 0.014886 -65282.3900
10: 0.006759 0.013744 -65281.9099
11: 0.005764 0.013076 -65281.4993
12: 0.004934 0.012372 -65281.1402
13: 0.004243 0.011651 -65280.8206
14: 0.003668 0.010931 -65280.5319
15: 0.003203 0.010226 -65280.2681
16: 0.002784 0.009545 -65280.0246
17: 0.002440 0.009030 -65279.7980
18: 0.002149 0.008690 -65279.5857
19: 0.001901 0.008387 -65279.3856
20: 0.001856 0.008113 -65279.1961
21: 0.001852 0.007865 -65279.0159
22: 0.001845 0.007636 -65278.8440
23: 0.001835 0.007424 -65278.6795
24: 0.001822 0.007236 -65278.5217
25: 0.001808 0.007124 -65278.3700
26: 0.001798 0.007018 -65278.2238
27: 0.001788 0.006917 -65278.0829
28: 0.001776 0.006820 -65277.9467
29: 0.001763 0.006726 -65277.8151
30: 0.001749 0.006634 -65277.6876
31: 0.001734 0.006545 -65277.5641
32: 0.001719 0.006457 -65277.4444
33: 0.001703 0.006371 -65277.3282
34: 0.001687 0.006286 -65277.2155
35: 0.001670 0.006201 -65277.1059
36: 0.001653 0.006118 -65276.9995
37: 0.001636 0.006034 -65276.8960
38: 0.001619 0.005952 -65276.7953
39: 0.001602 0.005869 -65276.6974
40: 0.001585 0.005787 -65276.6021
41: 0.001568 0.005705 -65276.5093
42: 0.001550 0.005624 -65276.4189
43: 0.001533 0.005559 -65276.3309
44: 0.001516 0.005550 -65276.2451
45: 0.001499 0.005543 -65276.1615
46: 0.001482 0.005537 -65276.0801
47: 0.001463 0.005532 -65276.0007
48: 0.001445 0.005528 -65275.9233
49: 0.001426 0.005525 -65275.8478
50: 0.001408 0.005523 -65275.7741
51: 0.001390 0.005521 -65275.7023
52: 0.001372 0.005519 -65275.6322
53: 0.001354 0.005518 -65275.5637
54: 0.001339 0.005517 -65275.4970
55: 0.001324 0.005508 -65275.4318
56: 0.001309 0.005477 -65275.3682
57: 0.001294 0.005446 -65275.3061
58: 0.001279 0.005415 -65275.2454
59: 0.001265 0.005384 -65275.1862
60: 0.001251 0.005354 -65275.1283
61: 0.001236 0.005323 -65275.0718
62: 0.001222 0.005292 -65275.0165
63: 0.001209 0.005261 -65274.9626
64: 0.001195 0.005230 -65274.9098
65: 0.001181 0.005199 -65274.8583
66: 0.001168 0.005167 -65274.8079
67: 0.001155 0.005136 -65274.7587
68: 0.001141 0.005104 -65274.7106
69: 0.001129 0.005073 -65274.6635
70: 0.001116 0.005041 -65274.6175
71: 0.001103 0.005009 -65274.5724
72: 0.001090 0.004976 -65274.5284
73: 0.001078 0.004944 -65274.4854
74: 0.001066 0.004912 -65274.4432
75: 0.001053 0.004879 -65274.4020
76: 0.001040 0.004846 -65274.3617
77: 0.001027 0.004814 -65274.3222
78: 0.001014 0.004781 -65274.2836
79: 0.001002 0.004748 -65274.2458
80: 0.000989 0.004715 -65274.2088
Moments of Latent Variable Distributions (group 1, 2, etc)
Mean: -0.000000 0.901525
s.d.: 0.999646 1.427310
我其实只需要最后两行里面的4个数据,想把它们保存在一个向量或矩阵里面,因为有很多类似文件需要读取,但是每个文件中的行数均不一样,不知道如何提取需要的数据。还请达人指点,谢谢!这个文件也上传了附件。


雷达卡



京公网安备 11010802022788号







