[Rd] Wait for user input with readline()
Alexandre
dam_damdeo33 at hotmail.com
Mon Dec 6 17:25:39 CET 2010
Hi,
I have a similar problem as the one of Nate. The point is that I want to
design an interactive script that need the value of two variables (x and y).
So my script as designed for the moment is :
x <- as.numeric (readline(prompt="What is the value of x? "))
y <- as.numeric (readline(prompt="What is the value of y? "))
x
y
But the problem is that if I run this script, values returned for x and y
will be "NA" like you can see below :
> x <- as.numeric (readline(prompt="What is the value of x? "))
What is the value of x?
> y <- as.numeric (readline(prompt="What is the value of y? "))
What is the value of y?
> x
[1] NA
> y
[1] NA
I have no problem to understand why, because R software does not let the
time to enter the value for each variable. So Nate and I want to know if
there is a way, to "force" R to wait the entrance of the value of each
variable like written below:
First step of the script :
> x <- as.numeric (readline(prompt="What is the value of x? "))
What is the value of x? 5
Second step of the script :
> y <- as.numeric (readline(prompt="What is the value of y? "))
What is the value of y? 9
Finally :
> x
[1] 5
> y
[1] 9
I hope that my english is not to bad and that you've understand what I mean.
Regards
Alexandre
--
View this message in context: http://r.789695.n4.nabble.com/Wait-for-user-input-with-readline-tp3054517p3074781.html
Sent from the R devel mailing list archive at Nabble.com.
More information about the R-devel
mailing list