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. Any help will be greatly appreciated. thanks in advance. Regards, Chiya [[alternative HTML version deleted]]
Hi cat("\n","Enter x","\n") # prompt y<-scan(n=1) prompts for user imput and scans 1 line from console. 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. > > Any help will be greatly appreciated. > thanks in advance. > > Regards, > Chiya > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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.Petr Pikal petr.pikal at precheza.cz
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