[R] R & bash script

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Feb 18 23:30:13 CET 2005


Christian Schulz <ozric at web.de> writes:

> Hi
> 
> how is it possible to use more than one command when i'm
> didn't want use R CMD BATCH for specific reason?
> 
> $ echo "(x<-1:10)" | R --vanilla
> works
> 
> $ echo "(x<-1:10 ;y<-20:30 ;lm(y ~ x))" | R --vanilla
> works not.

It would probably help to use proper R syntax:

> (x<-1:10 ;y<-20:30 ;lm(y ~ x))
Error: syntax error

What were those outer parentheses supposed to be good for?
 
> Is it further possible using  bash variables like $i  from a loop
> in the bash echo call  i.e.   dm$x$i$k <-
> read.data("dmdata$x$i$k.dat",header=T)

Yes. But it is not an R issue, so look up the details in the bash
manual.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list