Reputation: 1238
Into a csv file I have a column which contains logical operator values TRUE, FALSE.
When I use read.csv as following
it reads the column as character. How can I modify read.csv() to read it as logi?
I use this option of read as I have multiple csv files
files <- list.files(path = "C/path/files",pattern = ".csv")
temp <- lapply(files, fread, sep=",")
dframe <- rbindlist( temp )
Upvotes: 0
Views: 754
Reputation: 4233
Use the colClasses
argument of the read.csv
function. Provide a character vector of classes for the columns in your data set.
From the help page of read.csv
:
colClasses character. A vector of classes to be assumed for the columns...
Upvotes: 3