[R] Reading user input

projection83 mkurowski at gmail.com
Mon Apr 2 01:22:47 CEST 2007


Hi there, this is a very easy question, i just cant seem to find a straight
answer- i need this one thing, then i can finish my project for this term.

I am making an interactive application with R where I get the user to input
numbers that the program then uses in the analysis.  I have figured out a
lot of stuff, yet this is somehow hard to find the answer to:
#--------------------------------------------------
defineSamples<- function()
	{
	      ANSWER<-numeric()
              ANSWER<-readline("enter the number of groups: ")
	}

runit()

ANSWER # this does not hold the value the user inputs
#-------------------------------------------------

If I then see what ANSWER is storing it says "numeric(0)", how do I get this
to store whatever number the user inputs (and am i going to have to convert
from a string to a number???

THANKs for any help!
-- 
View this message in context: http://www.nabble.com/Reading-user-input-tf3503016.html#a9783275
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list