I am trying to specify colClasses in read.csv in an attempt to speed up the reading of csv file. However, I encounter the following problem:
assuming that i have a f
Your second column is not numeric
as it is quoted -- that makes it text.
So read it as text, then call as.numeric(...)
on the column. Or alter the file.
Further to Dirk,
You can simply drop the colClasses argument and the file will read in fine.
data <- read.csv('t.csv' , stringsAsFactors=FALSE, check.names=FALSE , comment.char='')
str(data)
Gives:
> str(data)
'data.frame': 1 obs. of 2 variables:
$ a: chr "x"
$ b: int 0
> class(data$b)
[1] "integer"
You should be able to do everything you want with that second column now.
GL