0

Hi I am trying to read a csv file that I have in my AWS bucket.

I am using the below code to read the csv file. but I am getting a error,

Error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns than column names

I read the previous post to solve , but I was unsuccessful, could any one help me to resolve this issue.

The code I am using

library("aws.s3")
# using account credentials
aws.signature::use_credentials()
#Read Claim data
c<- get_object("s3://data-eu1/flexibleanalysislist/Data.csv")
#Convert object and show the data
cobj <-rawToChar(c)
con <- textConnection(cobj)
data<- read.csv(con)
Mikz
  • 571
  • 2
  • 11
  • 29
  • 1
    maybe you can try passing in `header=FALSE` to take a look at your data. as the error msg mentions, you have more columns than column names – chinsoon12 Feb 19 '18 at 09:03
  • @chinsoon12 the error that I get now is "Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input" – Mikz Feb 19 '18 at 09:09
  • Add a sample (E.g. first 5 lines) of the csv file. – Terru_theTerror Feb 19 '18 at 09:12
  • Did you take a look at the answers provided [here](https://stackoverflow.com/questions/25771071/r-read-csv-more-columns-than-column-names-error/25771365) or [here](https://stackoverflow.com/questions/38311808/more-columns-than-column-names)? Not sure if it helps, but might be worth a try. – lisah Feb 19 '18 at 09:13
  • @Terru_theTerror , I simply changed the file name , and I was able to read the file :( – Mikz Feb 19 '18 at 09:14
  • 1
    @lisah I looked at both .. and it works now, just by renaming my file – Mikz Feb 19 '18 at 09:14
  • 2
    You might also try using `fread` (particularly the development version), which is much more robust in handling non-standard input .csv files – MichaelChirico Feb 19 '18 at 09:20

0 Answers0