Reputation: 127
I have a dataset called "rating.csv". The dataset look like this :
rating: 2.97, 3, 3, 3.41, 3.5, 3.5, 4, NULL, NULL, NULL, 3.67
I am trying to specify colClasses in read.csv to speed up the reading of csv file. First I create the colClasses like this :
classes <- c("double")
Then I read the dataset with
data <- read.csv('rating.csv', colClasses=classes,
comment.char="", na.strings='NULL')
But I get an error with this read.csv
Error in scan(file, what, nmax, sep, dec, quote, skip,
nlines, na.strings, : scan() expected 'a real', got '"3.67"'
Do you have any idea what's wrong with this code ? Or is there another way to change type of the dataset colclass besides in read.csv
?
Upvotes: 1
Views: 882
Reputation: 33
I think that means that your data is in string format instead of numeric/double/whatever options are available in csv format.
Upvotes: 0