tubby
tubby

Reputation: 2144

read.csv() warning: unable to read a csv file in R

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

Upvotes: 1

Views: 1620

Answers (2)

Ben Bolker
Ben Bolker

Reputation: 226077

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.

Upvotes: 0

hrbrmstr
hrbrmstr

Reputation: 78792

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")

Upvotes: 5

Related Questions