Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
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
freadis 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.