[R] Equivalent of read.table for object rather than file

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 5 20:26:03 CEST 2014


On 05/08/2014 19:15, sbihorel wrote:
> Hi,
>
> Thanks for the info. Unfortunately, read.table() does not have the text argument in the version of R that I can use.
> Do you know when was this argument introduced?

No, but the posting guide asked you to update *before posting* (have you 
yet read it?: you still sent HTML when asked not to).

In any case, the help text tells you how to do it: use a text connection.

>
> Sebastien
>
> On 05/08/2014 18:29, sbihorel wrote:
>> /  Hi,
> />/
> />/  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
> />/
> />/  Sebastien
> />/  //
> />/
> />/  	[[alternative HTML version deleted]]
> />/
> />/  ______________________________________________
> />/  R-help at r-project.org  <https://stat.ethz.ch/mailman/listinfo/r-help>  mailing list
> />/  https://stat.ethz.ch/mailman/listinfo/r-help
> />/  PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> />/  and provide commented, minimal, self-contained, reproducible code.
> />/
> /PLEASE do.
>


-- 
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 mailing list