Skip to content

fread(text=) breaks down when text has length 1 #5121

@michaelhallquist

Description

@michaelhallquist

I am using the data.table::fread command to parse a character vector that is the output of a system() call. It works very well, but breaks down strangely when the command only returns one row (i.e., when the character vector has length 1). Given that I use the text= argument, I don't know why I would get a complaint about a file not being found.

# Minimal reproducible example

bad <- "JobID|help|test"
data.table::fread(text=bad)

good <- c("JobID|help|test", "123|okay|tested")
data.table::fread(text=good)

# Output of sessionInfo()

R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.5.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] data.table_1.14.0

loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions