简体   繁体   中英

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. 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:

    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. More importantly I can read this CSV into a R dataframe with read.csv, then write a CSV file with write.table. Now I can load this "new" CSV into monetdb using the code above with no problem.

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样式的行尾?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM