[R] reading data on code script.

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Dec 16 18:43:38 CET 2007


Yes, for some ways of running a script (and you haven't told us how your 
intend to run this).  E.g.

% Rscript foo.R

works, where

% cat foo.R
mydata <- read.table(stdin(), header=TRUE, sep="\t", nrow=6)
freqesperado
117.5
147.5
47.5
17.5
27.7
16.3

mydata

But, e.g. you can't use source() (it parses the input before running it), 
amongst others.


Milton Cezar Ribeiro wrote:

> Dear All,
>
> It there a way of I read my data tab-separated on the own script, 
> without read from a external file and without type the data?
>
> I would like something like
>
> mydata<- read.data(head=T, sep="\t")
> freqesperado
> 117.5
> 147.5
> 47.5
> 17.5
>
> ##END OF DATA
>
> Many thanks, miltinho
>
>
>
> para armazenamento!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

PLEASE do, and avoid sending HTML as requested.

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