LibreOffice中的CSV列不匹配,但Excel中不匹配;can';t导入到R

LibreOffice中的CSV列不匹配,但Excel中不匹配;can';t导入到R,r,csv,R,Csv,这是一件刚刚开始发生的奇怪事情: 突然,我无法使用read.csv将.csv文件导入R 我注意到它们在Excel中正常打开,但在R中没有。它们是UTF-8 我认为这可能与前几行的处理方式有关。见下图 非常感谢您对解决此问题的任何帮助 readLines("~1_ShapeXC_N30_3.3_2021-04-25_21h4406175.csv", n=10) [1] "X Scale,Y Scale,key_resp_999.keys,key_resp_999.

这是一件刚刚开始发生的奇怪事情: 突然,我无法使用
read.csv
将.csv文件导入R

我注意到它们在Excel中正常打开,但在R中没有。它们是UTF-8

我认为这可能与前几行的处理方式有关。见下图

非常感谢您对解决此问题的任何帮助

readLines("~1_ShapeXC_N30_3.3_2021-04-25_21h4406175.csv", n=10)
 [1] "X Scale,Y Scale,key_resp_999.keys,key_resp_999.corr,key_resp_999.rt,key_resp_10.keys,key_resp_10.corr,key_resp_10.rt,prelim2loop.thisRepN,prelim2loop.thisTrialN,prelim2loop.thisN,prelim2loop.thisIndex,prelim2loop.ran,participant,session,date,expName,psychopyVersion,OS,frameRate,PROLIFIC_PID,STUDY_ID,SESSION_ID,key_resp_11.keys,key_resp_11.corr,key_resp_11.rt,prelim3loop.thisRepN,prelim3loop.thisTrialN,prelim3loop.thisN,prelim3loop.thisIndex,prelim3loop.ran,readybegin235loop.thisRepN,readybegin235loop.thisTrialN,readybegin235loop.thisN,readybegin235loop.thisIndex,readybegin235loop.ran,key_resp_xp.keys,key_resp_xp.rt,conf_rating.keys,conf_rating.rt,col_diff.keys,col_diff.rt,conf_rating_2.keys,conf_rating_2.rt,trials_5.thisRepN,trials_5.thisTrialN,trials_5.thisN,trials_5.thisIndex,trials_5.ran,ImageFile,Manipulation,spacetocontinue_3.keys,spacetocontinue_3.rt,trials_6.thisRepN,trials_6.thisTrialN,trials_6.thisN,trials_6.thisIndex,trials_6.ran,trials_10.thisRepN,trials_10.thisTrialN,trials_10.thisN,trials_10.thisIndex,trials_10.ran"
 [2] "0.05,0.05,space,0,106.066415,l,0,27.175845,0,0,0,0,1,1,001,2021-04-25_21h44.06.175,ShapeXC,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
 [3] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
 [4] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
 [5] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
 [6] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 [7] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
 [8] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 [9] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
[10] ",,,,,,,,,,,,,1,001,2021-04-25_21h44.06.175,ShapeXC_N30_3.3,2020.2.8,Win32,60,,"

Calc和Excel之间的外观不同这一事实表明它们不是真正的CSV(或兼容/兼容的CSV)。不管怎样,如果你已经证明数据在另外两个应用程序中导入的方式不同,那么为什么要使用标签呢?问题不在于R。最好包含文件顶部几行的文本(不是导入的,不是呈现的,只是文本)。使用
readLines(“filename.csv”,n=10)
并将结果作为代码发布。将
filename
替换为文件的实际名称。以原始注释发布,谢谢。“X”和“Scale”之间是否存在“空格”?