Skip to content

reading data on code script.

3 messages · Milton Cezar Ribeiro, Gabor Grothendieck, Brian Ripley

#
Try this:

Lines <- "freqesperado
117.5
147.5
47.5
17.5
"
read.table(textConnection(Lines), header = TRUE)

On Dec 16, 2007 10:47 AM, Milton Cezar Ribeiro
<milton_ruser at yahoo.com.br> wrote:
#
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:

            
PLEASE do, and avoid sending HTML as requested.