[R] User input from keyboard
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Aug 4 14:43:11 CEST 2006
On Fri, 4 Aug 2006, Petr Pikal wrote:
> Hi
>
> cat("\n","Enter x","\n") # prompt
> y<-scan(n=1)
>
> prompts for user imput and scans 1 line from console.
(that scans one number: use readLines(n=1) to get a string).
But readline() is probably easier.
>
> HTH
> Petr
>
>
>
> On 4 Aug 2006 at 17:06, chiya sharma wrote:
>
> Date sent: Fri, 4 Aug 2006 17:06:38 +0530
> From: "chiya sharma" <chiya31 at gmail.com>
> To: r-help at stat.math.ethz.ch
> Subject: [R] User input from keyboard
>
> > Dear All,
> >
> > Can anybody tell me the syntax for "User input from keyboard" in R. I
> > mean
> > to say that if I run the program it should ask "Please enter the date"
> > at the begining of the program. I am using R-2.2.1 for windows.
--
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