我是R的新手,我正在尝试使用csv.read函数导入.csv文件。关键是:即使我尝试使用它,该程序也仅返回1000多个行,因为它将每个逗号视为行分隔符,而不仅仅是列分隔符。我做错什么了吗?在尝试在此新文件上使用csv.read之前,它运行良好。我还应该做点其他事情吗?
x <- data.frame(read.csv("Caio0603__1.csv", sep = ",", header=FALSE)
编辑:抱歉,我忘记发布.csv文件。看起来像这样:
3/6/19
18:21
Subject name: Caio0603
File Name: Caio0603_
--------------------------
Phase 1
,,,,,,,,
-----------------------------
Phase 2,Practice
Trial No.,Sample,L Comp,R Comp,Response,Resp. Pos.,Resp. Stat.,Latency,
1,P2_3,N/A,N/A,z,L Key,1,2576,
2,Q2_4,N/A,N/A,z,L Key,0,1644,
3,P1_3,N/A,N/A,z,L Key,1,1599,
4,Q1_4,N/A,N/A,z,L Key,0,1846,
5,P2_2,N/A,N/A,m,R Key,0,674,
6,Q1_3,N/A,N/A,m,R Key,1,1516,
7,P1_1,N/A,N/A,m,R Key,0,1234,
8,Q2_2,N/A,N/A,m,R Key,1,964,
9,P2_4,N/A,N/A,z,L Key,1,1037,
10,Q2_3,N/A,N/A,m,R Key,1,790,
11,P1_2,N/A,N/A,z,L Key,1,1605,
12,Q1_1,N/A,N/A,m,R Key,1,1427,
13,Q2_1,N/A,N/A,m,R Key,1,798,
14,P2_1,N/A,N/A,z,L Key,1,739,
15,P1_4,N/A,N/A,m,R Key,0,849,
16,Q1_2,N/A,N/A,m,R Key,1,811,
,,,,,,,,
-----------------------------
Phase 3,
,,,,,,,,
-----------------------------
Phase 4,Inconsistent Block: A1-N1 B1-N2
Trial No.,Sample,L Comp,R Comp,Response,Resp. Pos.,Resp. Stat.,Latency,Lat+ITI+Fk,Cum. Lat.,Cum. Res.,Slope,Calc.,X,Y,Xsq,Ysq,XY,n,sX*sY,(sX*sY)/n,sXY-(sX*sY)/n,sX2,sX*sX,(sX*sX)/n,sX2-(sX*sX)/n,Num,Den,Slope,
1,B1_1,N/A,N/A,m,R Key,1,1071,2571,2.571,1, , ,2.571,1,6.610041,1,2.571,
2,A1_2,N/A,N/A,m,R Key,0,769,2269,4.84,1, , ,4.84,1,23.4256,1,4.84,
3,N2_2,N/A,N/A,no r,N/A,0,timeout,4500,9.34,1, , ,9.34,1,87.2356,1,9.34,
4,N1_4,N/A,N/A,no r,N/A,0,timeout,4500,13.84,1, , ,13.84,1,191.5456,1,13.84,
5,B1_2,N/A,N/A,m,R Key,1,1028,2528,16.368,2, , ,16.368,2,267.911424,4,32.736,
6,N1_2,N/A,N/A,z,L Key,1,1730,3230,19.598,3, , ,19.598,3,384.081604,9,58.794,
7,A1_4,N/A,N/A,z,L Key,1,968,2468,22.066,4, , ,22.066,4,486.908356,16,88.264,
8,N2_1,N/A,N/A,m,R Key,1,836,2336,24.402,5, , ,24.402,5,595.457604,25,122.01,
9,N1_1,N/A,N/A,z,L Key,1,798,2298,26.7,6, , ,26.7,6,712.89,36,160.2,
10,N2_3,N/A,N/A,m,R Key,1,768,2268,28.968,7, , ,28.968,7,839.145024,49,202.776,
11,B1_3,N/A,N/A,m,R Key,1,790,2290,31.258,8, , ,31.258,8,977.062564,64,250.064,
12,A1_1,N/A,N/A,z,L Key,1,782,2282,33.54,9, , ,33.54,9,1124.9316,81,301.86,
13,N1_3,N/A,N/A,z,L Key,1,581,2081,35.621,10, , ,35.621,10,1268.855641,100,356.21,
14,A1_3,N/A,N/A,z,L Key,1,633,2133,37.754,11, , ,37.754,11,1425.364516,121,415.294,
15,N2_4,N/A,N/A,m,R Key,1,591,2091,39.845,12, , ,39.845,12,1587.624025,144,478.14,
16,B1_4,N/A,N/A,z,L Key,0,585,2085,41.93,12, , ,41.93,12,1758.1249,144,503.16,
17,N1_4,N/A,N/A,z,L Key,1,571,2071,44.001,13, , ,44.001,13,1936.088001,169,572.013,
18,A1_1,N/A,N/A,z,L Key,1,514,2014,46.015,14, , ,46.015,14,2117.380225,196,644.21,
19,B1_4,N/A,N/A,m,R Key,1,572,2072,48.087,15, , ,48.087,15,2312.359569,225,721.305,
20,N2_2,N/A,N/A,m,R Key,1,540,2040,50.127,16, , ,50.127,16,2512.716129,256,802.032,
21,N1_2,N/A,N/A,z,L Key,1,638,2138,52.265,17, , ,52.265,17,2731.630225,289,888.505,
22,A1_3,N/A,N/A,z,L Key,1,605,2105,54.37,18, , ,54.37,18,2956.0969,324,978.66,
23,N2_3,N/A,N/A,m,R Key,1,492,1992,56.362,19, , ,56.362,19,3176.675044,361,1070.878,
24,B1_3,N/A,N/A,m,R Key,1,615,2115,58.477,20, , ,58.477,20,3419.559529,400,1169.54,
25,N2_4,N/A,N/A,m,R Key,1,559,2059,60.536,21, , ,60.536,21,3664.607296,441,1271.256,
26,B1_2,N/A,N/A,m,R Key,1,579,2079,62.615,22, , ,62.615,22,3920.638225,484,1377.53,
27,N1_3,N/A,N/A,z,L Key,1,550,2050,64.665,23, , ,64.665,23,4181.562225,529,1487.295,
28,A1_2,N/A,N/A,z,L Key,1,661,2161,66.826,24, , ,66.826,24,4465.714276,576,1603.824,
29,N1_1,N/A,N/A,z,L Key,1,608,2108,68.934,25, , ,68.934,25,4751.896356,625,1723.35,
30,N2_1,N/A,N/A,m,R Key,1,529,2029,70.963,26, , ,70.963,26,5035.747369,676,1845.038,
31,A1_4,N/A,N/A,z,L Key,1,532,2032,72.995,27, , ,72.995,27,5328.270025,729,1970.865,
32,B1_1,N/A,N/A,m,R Key,1,516,2016,75.011,28, , ,75.011,28,5626.650121,784,2100.308,
33,B1_3,N/A,N/A,m,R Key,1,676,2176,77.187,29, , ,77.187,29,5957.832969,841,2238.423,
34,N1_2,N/A,N/A,z,L Key,1,481,1981,79.168,30, , ,79.168,30,6267.572224,900,2375.04,
35,A1_1,N/A,N/A,z,L Key,1,554,2054,81.222,31, , ,81.222,31,6597.013284,961,2517.882,
36,N2_2,N/A,N/A,m,R Key,1,457,1957,83.179,32, , ,83.179,32,6918.746041,1024,2661.728,
37,N1_1,N/A,N/A,z,L Key,1,546,2046,85.225,33, , ,85.225,33,7263.300625,1089,2812.425,
38,B1_1,N/A,N/A,m,R Key,1,494,1994,87.219,34, , ,87.219,34,7607.153961,1156,2965.446,
39,A1_2,N/A,N/A,z,L Key,1,523,2023,89.242,35, , ,89.242,35,7964.134564,1225,3123.47,
40,N2_4,N/A,N/A,m,R Key,1,438,1938,91.18,36, , ,91.18,36,8313.7924,1296,3282.48,
41,A1_3,N/A,N/A,z,L Key,1,450,1950,93.13,37, , ,93.13,37,8673.1969,1369,3445.81,
42,B1_2,N/A,N/A,m,R Key,1,461,1961,95.091,38, , ,95.091,38,9042.298281,1444,3613.458,
43,N2_1,N/A,N/A,m,R Key,1,427,1927,97.018,39, , ,97.018,39,9412.492324,1521,3783.702,
44,N1_4,N/A,N/A,z,L Key,1,536,2036,99.054,40, , ,99.054,40,9811.694916,1600,3962.16,
45,A1_4,N/A,N/A,m,R Key,0,395,1895,100.949,40, , ,100.949,40,10190.700601,1600,4037.96,
46,N1_3,N/A,N/A,z,L Key,1,467,1967,102.916,41, , ,102.916,41,10591.703056,1681,4219.556,
47,B1_4,N/A,N/A,m,R Key,1,529,2029,104.945,42, , ,104.945,42,11013.453025,1764,4407.69,
48,N2_3,N/A,N/A,m,R Key,1,533,2033,106.978,43, , ,106.978,43,11444.292484,1849,4600.054,
49,N1_3,N/A,N/A,z,L Key,1,412,1912,108.89,44, , ,108.89,44,11857.0321,1936,4791.16,
50,N2_1,N/A,N/A,m,R Key,1,440,1940,110.83,45, , ,110.83,45,12283.2889,2025,4987.35,
,,,,,,,, , , ,0.445313,sum,3034.313,1090,231084.464269,33142,87052.502,50,3307401.17,66148.0234,20904.4786,231084.464269,9207055.381969,184141.107639,46943.35663,20904.4786,46943.35663,0.445313,
SLOPE OF INCONSISTENT BLOCK = 0.445313
-----------------------------
Phase 5,Consistent Block: A1-B1 N1-N2
Trial No.,Sample,L Comp,R Comp,Response,Resp. Pos.,Resp. Stat.,Latency,Lat+ITI+Fk,Cum. Lat.,Cum. Res.,Slope,Calc.,X,Y,Xsq,Ysq,XY,n,sX*sY,(sX*sY)/n,sXY-(sX*sY)/n,sX2,sX*sX,(sX*sX)/n,sX2-(sX*sX)/n,Num,Den,Slope,
1,B1_4,N/A,N/A,m,R Key,0,549,2049,2.049,0, , ,2.049,0,4.198401,0,0,
2,N2_3,N/A,N/A,m,R Key,1,595,2095,4.144,1, , ,4.144,1,17.172736,1,4.144,
3,N1_1,N/A,N/A,m,R Key,1,507,2007,6.151,2, , ,6.151,2,37.834801,4,12.302,
4,A1_1,N/A,N/A,z,L Key,1,520,2020,8.171,3, , ,8.171,3,66.765241,9,24.513,
5,N2_1,N/A,N/A,m,R Key,1,557,2057,10.228,4, , ,10.228,4,104.611984,16,40.912,
6,A1_3,N/A,N/A,z,L Key,1,746,2246,12.474,5, , ,12.474,5,155.600676,25,62.37,
7,B1_3,N/A,N/A,z,L Key,1,475,1975,14.449,6, , ,14.449,6,208.773601,36,86.694,
8,N1_3,N/A,N/A,m,R Key,1,421,1921,16.37,7, , ,16.37,7,267.9769,49,114.59,
9,B1_1,N/A,N/A,z,L Key,1,457,1957,18.327,8, , ,18.327,8,335.878929,64,146.616,
10,A1_4,N/A,N/A,z,L Key,1,554,2054,20.381,9, , ,20.381,9,415.385161,81,183.429,
11,N2_4,N/A,N/A,m,R Key,1,573,2073,22.454,10, , ,22.454,10,504.182116,100,224.54,
12,N1_2,N/A,N/A,z,L Key,0,458,1958,24.412,10, , ,24.412,10,595.945744,100,244.12,
13,N2_2,N/A,N/A,m,R Key,1,1086,2586,26.998,11, , ,26.998,11,728.892004,121,296.978,
14,A1_2,N/A,N/A,z,L Key,1,645,2145,29.143,12, , ,29.143,12,849.314449,144,349.716,
15,B1_2,N/A,N/A,m,R Key,0,546,2046,31.189,12, , ,31.189,12,972.753721,144,374.268,
16,N1_4,N/A,N/A,z,L Key,0,575,2075,33.264,12, , ,33.264,12,1106.493696,144,399.168,
17,B1_2,N/A,N/A,m,R Key,0,658,2158,35.422,12, , ,35.422,12,1254.718084,144,425.064,
18,N2_4,N/A,N/A,m,R Key,1,696,2196,37.618,13, , ,37.618,13,1415.113924,169,489.034,
19,A1_4,N/A,N/A,z,L Key,1,389,1889,39.507,14, , ,39.507,14,1560.803049,196,553.098,
20,N1_3,N/A,N/A,z,L Key,0,487,1987,41.494,14, , ,41.494,14,1721.752036,196,580.916,
21,N1_4,N/A,N/A,m,R Key,1,746,2246,43.74,15, , ,43.74,15,1913.1876,225,656.1,
22,B1_4,N/A,N/A,m,R Key,0,527,2027,45.767,15, , ,45.767,15,2094.618289,225,686.505,
23,N2_1,N/A,N/A,m,R Key,1,565,2065,47.832,16, , ,47.832,16,2287.900224,256,765.312,
24,A1_1,N/A,N/A,z,L Key,1,438,1938,49.77,17, , ,49.77,17,2477.0529,289,846.09,
25,N2_2,N/A,N/A,m,R Key,1,507,2007,51.777,18, , ,51.777,18,2680.857729,324,931.986,
26,B1_3,N/A,N/A,z,L Key,1,451,1951,53.728,19, , ,53.728,19,2886.697984,361,1020.832,
27,A1_2,N/A,N/A,z,L Key,1,510,2010,55.738,20, , ,55.738,20,3106.724644,400,1114.76,
28,N1_1,N/A,N/A,m,R Key,1,622,2122,57.86,21, , ,57.86,21,3347.7796,441,1215.06,
29,B1_1,N/A,N/A,z,L Key,1,476,1976,59.836,22, , ,59.836,22,3580.346896,484,1316.392,
30,N1_2,N/A,N/A,m,R Key,1,449,1949,61.785,23, , ,61.785,23,3817.386225,529,1421.055,
31,A1_3,N/A,N/A,z,L Key,1,450,1950,63.735,24, , ,63.735,24,4062.150225,576,1529.64,
32,N2_3,N/A,N/A,m,R Key,1,500,2000,65.735,25, , ,65.735,25,4321.090225,625,1643.375,
33,A1_3,N/A,N/A,z,L Key,1,358,1858,67.593,26, , ,67.593,26,4568.813649,676,1757.418,
34,B1_4,N/A,N/A,m,R Key,0,493,1993,69.586,26, , ,69.586,26,4842.211396,676,1809.236,
35,N1_4,N/A,N/A,z,L Key,0,392,1892,71.478,26, , ,71.478,26,5109.104484,676,1858.428,
36,N2_2,N/A,N/A,m,R Key,1,537,2037,73.515,27, , ,73.515,27,5404.455225,729,1984.905,
37,N1_2,N/A,N/A,m,R Key,1,480,1980,75.495,28, , ,75.495,28,5699.495025,784,2113.86,
38,B1_2,N/A,N/A,m,R Key,0,444,1944,77.439,28, , ,77.439,28,5996.798721,784,2168.292,
39,N2_4,N/A,N/A,m,R Key,1,480,1980,79.419,29, , ,79.419,29,6307.377561,841,2303.151,
40,A1_4,N/A,N/A,z,L Key,1,418,1918,81.337,30, , ,81.337,30,6615.707569,900,2440.11,
41,A1_1,N/A,N/A,m,R Key,0,395,1895,83.232,30, , ,83.232,30,6927.565824,900,2496.96,
42,B1_3,N/A,N/A,m,R Key,0,402,1902,85.134,30, , ,85.134,30,7247.797956,900,2554.02,
43,N2_1,N/A,N/A,m,R Key,1,372,1872,87.006,31, , ,87.006,31,7570.044036,961,2697.186,
44,N1_3,N/A,N/A,m,R Key,1,448,1948,88.954,32, , ,88.954,32,7912.814116,1024,2846.528,
45,A1_2,N/A,N/A,z,L Key,1,378,1878,90.832,33, , ,90.832,33,8250.452224,1089,2997.456,
46,B1_1,N/A,N/A,z,L Key,1,596,2096,92.928,34, , ,92.928,34,8635.613184,1156,3159.552,
47,N1_1,N/A,N/A,z,L Key,0,424,1924,94.852,34, , ,94.852,34,8996.901904,1156,3224.968,
48,N2_3,N/A,N/A,m,R Key,1,591,2091,96.943,35, , ,96.943,35,9397.945249,1225,3393.005,
49,N2_1,N/A,N/A,m,R Key,1,552,2052,98.995,36, , ,98.995,36,9800.010025,1296,3563.82,
50,B1_1,N/A,N/A,z,L Key,1,412,1912,100.907,37, , ,100.907,37,10182.222649,1369,3733.559,
,,,,,,,, , , ,0.358851,sum,2607.193,952,178365.290591,23620,64862.033,50,2482047.736,49640.95472,15221.07828,178365.290591,6797455.339249,135949.106785,42416.183806,15221.07828,42416.183806,0.358851,
SLOPE OF CONSISTENT BLOCK = 0.358851
-----------------------------
Phase 6,
,,,,,,,,
-----------------------------
答案 0 :(得分:0)
您的csv文件对我而言似乎不一致。您是否有太多文件,或者只想导入此文件?特别是这部分打破了它:“第二阶段,实践”
如果您以下面的格式编写txt / csv文件,它将正常工作。因此,如果仅此文件,则可以使用手动修复解决方案,将每个阶段添加到单独的文件中。否则,THIS解决方案将适合您的情况。
试验编号,样品,L Comp,R Comp,响应,响应位置,响应统计信息,延迟时间
1,P2_3,N / A,N / A,z,L键,1,2576,
2,Q2_4,N / A,N / A,z,L键,0,1644,
3,P1_3,N / A,N / A,z,L键,1,1599,
4,Q1_4,N / A,N / A,z,L键,0,1846,