Skip to content

Commit

Permalink
use writeLines for fread(text=.) (#4805)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored May 11, 2021
1 parent 7e89b52 commit 3764969
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/fread.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ yaml=FALSE, autostart=NA, tmpdir=tempdir(), tz="UTC")
if (!is.character(text)) stop("'text=' is type ", typeof(text), " but must be character.")
if (!length(text)) return(data.table())
if (length(text) > 1L) {
cat(text, file=(tmpFile<-tempfile(tmpdir=tmpdir)), sep="\n") # avoid paste0() which could create a new very long single string in R's memory
writeLines(text, tmpFile<-tempfile(tmpdir=tmpdir)) # avoid paste0() which could create a new very long single string in R's memory
file = tmpFile
on.exit(unlink(tmpFile), add=TRUE)
} else {
Expand Down

0 comments on commit 3764969

Please sign in to comment.