[R] scan in batch use (was another little problem embedding R)

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Aug 14 17:44:36 CEST 2001


On Tue, 14 Aug 2001, Didier Leibovici wrote:

> I was using
> num <-scan("",numeric(0))
> in a file to be ran in batch or with R --vanilla <bidon.R
>
> but I don't know how to make it wait for the value ???

Don't use "" (which is stdin in scan) in a batch script.  Read from some
other connection.

BTW, you don't seem to be embedding R.

> i.e. if you do the same typing
>
> 19 didier at mace $ R --vanilla
>
> R : Copyright 2001, The R D
>
> > source("bidon.R")
> 1: 1
> 2: 33
> 3: 999
> 4:
> Read 3 items
> > num
> [1]   1  33 999
> > q()
>
> the "batch" gave
> 20 didier at mace $ R --vanilla <bidon.R
>
> R : Copyright 2001, The R Development Core Team
> Version 1.2.3  (2001-04
> > num <- scan("",numeric(0))
> 1: Read 0 items
> > q()
>
> and if you put source("bidon.R) in Runbidon.R
> 22 didier at mace $ R --vanilla <Runbidon.R
> ...
> > source("bidon.R")
> 1: Read 0 items
> >
> 23 didier at mace $
>
>
> Is there any options or variables to change to make it ...wait!
> thanks
> --
>   Didier G. Leibovici    didier at fmrib.ox.ac.uk    +44 (0)1865 222 739
> Image Analysis Group                          fax:+44 (0)1865 222 717
> Oxford University, Centre For Functional Magnetic Resonance Imaging of
> the Brain (FMRIB), John Radcliffe Hospital, Headington, Oxford OX3 9DU,
> U.K
> http://www.fmrib.ox.ac.uk/~didier/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list