[R] Equivalent of read.table for object rather than file
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Aug 5 19:40:54 CEST 2014
On 05/08/2014 18:29, sbihorel wrote:
> Let's say that I have a scalar character object called tmp which stores
> the entire content of an ASCII file. Is there a function that would
> process tmp the same way read.table() would process the content of the
> original ASCII file?
> The content of tmp will come from a database, and I want to extract the
> data without writing and reading to disk or without asking the database
> to transform the file content into a table.
The equivalent is read.table. See its 'text' argument:
text: character string: if ‘file’ is not supplied and this is, then
data are read from the value of ‘text’ via a text connection.
Notice that a literal string can be used to include (small)
data sets within R code.
> Thank you
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help