I'm working with large datasets (around 4GB), mixing dates, numbers and factors.
And I want to perform operations such as changing all column classes to character.
mydata[, names(mydata) := lapply(.SD, as.character)]
But it's quite slow.
If you just had the data on the disk and reload it with
my <- fread("mydata.csv", stringsAsFactors=F, colClasses=list(character=1:3775))
it's much faster.
Is there alternative to the first method?
Or maybe it could be improved in some way.
I'm working with large datasets (around 4GB), mixing dates, numbers and factors.
And I want to perform operations such as changing all column classes to character.
mydata[, names(mydata) := lapply(.SD, as.character)]But it's quite slow.
If you just had the data on the disk and reload it with
my <- fread("mydata.csv", stringsAsFactors=F, colClasses=list(character=1:3775))it's much faster.
Is there alternative to the first method?
Or maybe it could be improved in some way.