I added spaces around my fields in CSV file in Vim csv.vim plugin.
Now, I am having difficulties in declaring the column classes as numerical (
Having negative values there also cause problems in the following columns
The data can have empty fields.
Test, test2, test3 , 1 , 1 10.8, -1 , 1 1.1 , 2 , 2
library('methods') DF <- read.csv("/home/masi/Data/data.csv", header = T, sep = ",", colClasses=c('num','num')) DF
Error in methods::as(data[[i]], colClasses[i]) : no method or default for coercing “character” to “num” Calls: read.csv -> read.table -> <Anonymous> Execution halted
- Casting to numerical fails when doing
- Output in Column 3 is considered as
NAbecause of one minus mark (
-1) in the second column.