Re: [R] Reading user input

From: jim holtman <jholtman_at_gmail.com>
Date: Wed 04 Apr 2007 - 11:36:51 GMT

That is exactly what the code does.

On 4/3/07, projection83 <mkurowski@gmail.com> wrote:
>
>
> I dont know if thats what i want (its not working like i want). I would
> like
> to have R pause, wait for a user input of a number, then store that number
> as a variable to use in the next calculation it does...
> Or should the below do that?
>
>
> jim holtman wrote:
> >
> > what you want is:
> >
> > defineSamples<- function()
> > {
> > readline("enter the number of groups: ")
> > }
> >
> > ANSWER <- defineSamples()
> >
> >
> >
> > On 4/1/07, projection83 <mkurowski@gmail.com> wrote:
> >>
> >>
> >> 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.
> >>
> >> ______________________________________________
> >> R-help@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.
> >>
> >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem you are trying to solve?
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@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.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Reading-user-input-tf3503016.html#a9830512
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help@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.
Received on Wed Apr 04 21:43:02 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 04 Apr 2007 - 13:31:00 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.