quanteda / readtext

an R package for reading text files
https://readtext.quanteda.io
118 stars 28 forks source link

Failed to load csv with R 3.5.1 #138

Closed justinchuntingho closed 5 years ago

justinchuntingho commented 5 years ago

My readtext was working fine but it failed to read csv after I updated to 3.5.1

Here's a reproducible error: write.csv(c("foo foo foo foo", "bar bar bar bar"), file = "data.csv", row.names = FALSE) library(readtext) readtext("data.csv")

The error message:

Error in if (nrow(x) == 0) return(x) : argument is of length zero

Here's my sessioninfo:

R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.2

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] readtext_0.71

loaded via a namespace (and not attached): [1] httr_1.3.1 compiler_3.5.1 R6_2.2.2 tools_3.5.1
[5] pillar_1.3.0 rstudioapi_0.7 tibble_1.4.2 yaml_2.2.0
[9] crayon_1.3.4 stringi_1.2.4 data.table_1.11.4 rlang_0.2.2

justinchuntingho commented 5 years ago

The codes should be three separated lines, sorry about the formatting.

write.csv(c("foo foo foo foo", "bar bar bar bar"), file = "data.csv", row.names = FALSE)
library(readtext)
readtext("data.csv")
kbenoit commented 5 years ago

Thanks @justinchuntingho!

For future reference, you can paste code in a code block, using r for the language identifier.