Re: [R] Problem building/checking library that requires input from user

From: Ken Termiso <jerk_alert_at_hotmail.com>
Date: Tue 04 Oct 2005 - 02:29:13 EST


It was in a plain R file...I did not interpret the word 'example' in your email as I should've...

So, i've been able to fix the num_reps variable problem - thanks!!

>From: "Warnes, Gregory R" <gregory.r.warnes@pfizer.com>
>To: "'Ken Termiso'" <jerk_alert@hotmail.com>
>CC: "R-Help (E-mail)" <r-help@stat.math.ethz.ch>
>Subject: RE: [R] Problem building/checking library that requires input from
>user
>Date: Mon, 3 Oct 2005 11:48:28 -0400
>
>What file are you putting these into?
>
>I believe this is the correct syntax for the \example{} section of an .Rd
>file.
>
>If you want to do this in a plain R file, (e.g. package/tests/somename.R),
>you can use
>
>if(interactive)
>{
> num_reps <- readline(""How many reps do you have... ")
> num_reps <- as.integer(num_reps)
>}
>else
> num_reps <- 10
>
>instead.
>
>-G
>
>
> > -----Original Message-----
> > From: Ken Termiso [mailto:jerk_alert@hotmail.com]
> > Sent: Monday, October 03, 2005 11:42 AM
> > To: Warnes, Gregory R; ripley@stats.ox.ac.uk
> > Cc: r-help@stat.math.ethz.ch
> > Subject: RE: [R] Problem building/checking library that requires input
> > from user
> >
> >
> > Thanks, Dr Warnes & Prof Ripley...
> >
> > However, upon following the instructions below, I'm getting
> > syntax errors on
> > the line that has \dontshow...below is my code...I get the
> > same error if i
> > omit the first block and just try \dontrun...
> >
> > \dontshow{
> > num_reps <- 10
> > }
> >
> > \dontrun{
> > num_reps <- readline(""How many reps do you have... ")
> > num_reps <- as.integer(num_reps)
> > }
> >
> >
> > could this have anything to do with it running on OS X 10.3 ?? (long
> > shot...but i'm thoroughly lost)..
> >
> > thanks again,
> > ken
> >
> >
> > >From: "Warnes, Gregory R" <gregory.r.warnes@pfizer.com>
> > >To: "'Ken Termiso'" <jerk_alert@hotmail.com>
> > >Subject: RE: [R] Problem building/checking library that
> > requires input from
> > >user
> > >Date: Mon, 3 Oct 2005 10:11:15 -0400
> > >
> > >
> > >Try changing the example code to:
> > >
> > >\dontshow{
> > > num_reps <- 10
> > >}
> > >\dontrun{
> > > num_reps <- readline("How many reps do you have... ")
> > > num_reps <- as.integer(num_reps)
> > >}
> > >
> > >-Greg
> > >
> > >
> > > > -----Original Message-----
> > > > From: r-help-bounces@stat.math.ethz.ch
> > > > [mailto:r-help-bounces@stat.math.ethz.ch]On Behalf Of Ken Termiso
> > > > Sent: Monday, October 03, 2005 9:41 AM
> > > > To: r-help@stat.math.ethz.ch
> > > > Subject: [R] Problem building/checking library that requires
> > > > input from
> > > > user
> > > >
> > > >
> > > > Hi all,
> > > >
> > > > I've got a package i've written that i am trying to
> > check, build, and
> > > > install. This is my 1st time doing this, so apologies in
> > advance... ;)
> > > >
> > > > The package that I've written requires input from the user.
> > > > It needs to know
> > > > sample sizes and then runs some calcs, (sample sizes are just
> > > > integers), and
> > > > it gets this info from the user as
> > > >
> > > > num_reps <- readline("How many reps do you have... ")
> > > >
> > > > num_reps <- as.integer(num_reps)
> > > >
> > > > and then loops
> > > >
> > > > for(i in 1:num_reps)
> > > > {
> > > > #code
> > > > }
> > > >
> > > >
> > > > HOWEVER, I get this error msg when trying to check/build/install:
> > > >
> > > > Error in 1:num_con_biol_reps : NA/NaN argument
> > > >
> > > > Presumably this is because R thinks the variable is never
> > > > initialized before
> > > > i try to use it as a loop limit...
> > > >
> > > > Anyway around this?? I tried initializing the num_reps
> > > > variable in the code
> > > > before the readline, but get the same error...
> > > >
> > > >
> > > > Thanks very much in advance,
> > > > Ken
> > > >
> > > > ______________________________________________
> > > > 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
> > > >
> > > >
> > >-------------------------------------------------------------
> > ---------
> > >LEGAL NOTICE
> > >Unless expressly stated otherwise, this message is
> > confidential and may be
> > >privileged. It is intended for the addressee(s) only.
> > Access to this
> > >E-mail by anyone else is unauthorized. If you are not an
> > addressee, any
> > >disclosure or copying of the contents of this E-mail or any
> > action taken
> > >(or not taken) in reliance on it is unauthorized and may be
> > unlawful. If
> > >you are not an addressee, please inform the sender immediately.
> >
> >
> >
> >



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 Received on Tue Oct 04 02:34:11 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:15:01 EST