You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fread() cannot read from a multi-line text object, but it can read a length 1 character vector. Multi-line vectors are typically created using readLines(). My feature request is to support input from multi-line character vectors, as read.table() does.
read.table() accepts character vector input in two ways:
as a text connection on the file= argument -- read.table(file=textConnection(textvar,...),...), or
using the text= argument, which wraps the input with a textConnection().
In both cases, the character vector can be of any length, and is read as text lines.
A work-around for fread is to collapse the character vector to length 1, using paste0() or stri_flatten(), as in
and use the result as input to the fread's input= argument. Unless a faster way is immediately obvious, the text= argument could be initially implemented using one of these collapse functions. This would be quite convenient when text files need pre-processing before reading with fread..
When connections are implemented in fread (#561) then the text= argument could be implemented as a textConnection, as read.table(text=...) now does.
The text was updated successfully, but these errors were encountered:
fread()
cannot read from a multi-line text object, but it can read a length 1 character vector. Multi-line vectors are typically created usingreadLines()
. My feature request is to support input from multi-line character vectors, asread.table()
does.read.table()
accepts character vector input in two ways:read.table(file=textConnection(textvar,...),...)
, ortext=
argument, which wraps the input with atextConnection()
.In both cases, the character vector can be of any length, and is read as text lines.
A work-around for
fread
is to collapse the character vector to length 1, usingpaste0()
orstri_flatten()
, as inand use the result as input to the fread's
input=
argument. Unless a faster way is immediately obvious, thetext=
argument could be initially implemented using one of these collapse functions. This would be quite convenient when text files need pre-processing before reading with fread..When connections are implemented in fread (#561) then the text= argument could be implemented as a
textConnection
, asread.table(text=...)
now does.The text was updated successfully, but these errors were encountered: