[英]CSV load error with monetdb & R
I'm trying to load various CSVs into monetdb, using R and RStudio but I get the error below. 我正在尝试使用R和RStudio将各种CSV加载到monetdb中,但出现以下错误。 This is the code (code tested with the iris dataset & generally working fine) and the error message:
这是代码(使用虹膜数据集测试的代码,通常可以正常工作)和错误消息:
> monetdb.read.csv(conn,fnamed,nrows=nrows,header=TRUE,tablename=tabled,delim=",")
/Users/Enzo/NHS/data/sha_lookup.csv /Users/Enzo/NHS/data/sha_lookup.csv
Error in .local(conn, statement, ...) :
Unable to execute statement 'copy 12 offset 2 records into sha_lookup from '/Users/Enzo/NHS/data/sh...'.
Server says '!failed to import table'.
The file I'm trying to load is a short and simple csv: 我要加载的文件是一个简短的csv:
SHA,SHAname
Q30,NORTH EAST STRATEGIC HEALTH AUTHORITY
Q31,NORTH WEST STRATEGIC HEALTH AUTHORITY
Q32,YORKSHIRE AND THE HUMBER STRATEGIC HEALTH AUTHORITY
Q33,EAST MIDLANDS STRATEGIC HEALTH AUTHORITY
Q34,WEST MIDLANDS STRATEGIC HEALTH AUTHORITY
Q35,EAST OF ENGLAND STRATEGIC HEALTH AUTHORITY
Q36,LONDON STRATEGIC HEALTH AUTHORITY
Q37,SOUTH EAST COAST STRATEGIC HEALTH AUTHORITY
Q38,SOUTH CENTRAL STRATEGIC HEALTH AUTHORITY
Q39,SOUTH WEST STRATEGIC HEALTH AUTHORITY
RStudio reads the above CSV file with no issues. RStudio可以正确读取上述CSV文件。 More importantly I can read this CSV into a R dataframe with read.csv, then write a CSV file with write.table.
更重要的是,我可以使用read.csv将CSV读取到R数据框中,然后使用write.table写入CSV文件。 Now I can load this "new" CSV into monetdb using the code above with no problem.
现在,可以毫无问题地使用上面的代码将此“新” CSV加载到monetdb中。
Please note that I tried to edit the file using quotes "" everywhere to see if that was the problem, but I still got the error. 请注意,我尝试在各处使用引号“”编辑文件,以查看是否是问题所在,但仍然出现错误。
您的原始文件是否具有Windows样式的行尾?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.