We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submitted by: Artem Klevtsov; Assigned to: Nobody; R-Forge link
fread's argument stringsAsFactors has no effect when set to TRUE.
fread
stringsAsFactors
TRUE
file <- tempfile() DF <- data.frame(A = 1:10, B = LETTERS[1:10]) sapply(DF, class) # A B # "integer" "factor" write.table(DF, file, sep = ";", row.names = FALSE) # fread's stringsAsFactors has no effect DT <- fread(file, sep = ";", stringsAsFactors = TRUE) sapply(DT, class) # A B # "integer" "character"
Here's the same file read using read.csv():
read.csv()
DF2 <- read.csv(file, sep = ";", stringsAsFactors = TRUE) sapply(DF2, class) # A B # "integer" "factor" DF3 <- read.csv(file, sep = ";", stringsAsFactors = FALSE) sapply(DF3, class) # A B # "integer" "character" unlink(file)
Here's the sessionInfo() output:
sessionInfo()
sessionInfo() # R version 3.0.2 (2013-09-25) # Platform: x86_64-unknown-linux-gnu (64-bit) # # locale: # [1] LC_CTYPE=ru_RU.UTF-8 LC_NUMERIC=C LC_TIME=ru_RU.UTF-8 # [4] LC_COLLATE=C LC_MONETARY=ru_RU.UTF-8 LC_MESSAGES=ru_RU.UTF-8 # [7] LC_PAPER=ru_RU.UTF-8 LC_NAME=C LC_ADDRESS=C # [10] LC_TELEPHONE=C LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C # attached base packages: # [1] stats graphics grDevices utils datasets methods base # # other attached packages: # [1] data.table_1.8.11 # # loaded via a namespace (and not attached): # [1] plyr_1.8 reshape2_1.2.2 stringr_0.6.2 tools_3.0.2
The text was updated successfully, but these errors were encountered:
same here :(
Sorry, something went wrong.
Hi all, I have the same problem
same here
Guys you can stop commenting- it is the same for everyone without exceptions.
f9536bc
arunsrinivasan
No branches or pull requests
Submitted by: Artem Klevtsov; Assigned to: Nobody; R-Forge link
fread
's argumentstringsAsFactors
has no effect when set toTRUE
.Here's the same file read using
read.csv()
:Here's the
sessionInfo()
output:The text was updated successfully, but these errors were encountered: