1

I was trying to read a csv file in R and read.csv gives me a warning and consequently stops reading from there on. I think it's something related to an extra quote being there. How can I resolve this?

(csv file put on a public share below for access)

> scoresdf = read.csv('http://aftabubuntu.cloudapp.net/trainDataEnglish.csv')
Warning message:
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  EOF within quoted string
swihart
  • 2,275
  • 2
  • 16
  • 35
tubby
  • 1,984
  • 3
  • 28
  • 51
  • I'd imagine the problem has to do with encoding? Are you on Windows? You can try explicitly specifying UTF-8 encoding (the default for Windows is usually Latin-1). – MrFlick Apr 14 '15 at 05:17

2 Answers2

5

I got the same error on read.csv. I managed to get it working with the rio package:

library(rio)
dat <- import("http://aftabubuntu.cloudapp.net/trainDataEnglish.csv")

and the readr package:

library(readr)
dat <- read_csv("http://aftabubuntu.cloudapp.net/trainDataEnglish.csv")

and the data.table package:

library(data.table)
dat <- fread("http://aftabubuntu.cloudapp.net/trainDataEnglish.csv")
hrbrmstr
  • 74,560
  • 11
  • 127
  • 189
0

Try

url <- 'http://aftabubuntu.cloudapp.net/trainDataEnglish.csv'
scoresdf = read.csv(url,quote="")

As you suspected, there is indeed an embedded quotation mark somewhere within your document.

Ben Bolker
  • 192,494
  • 24
  • 350
  • 426