Warnes, Gregory R
2005-Oct-03 15:48 UTC
[R] Problem building/checking library that requires input fro m user
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 at hotmail.com] > Sent: Monday, October 03, 2005 11:42 AM > To: Warnes, Gregory R; ripley at stats.ox.ac.uk > Cc: r-help at 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 at pfizer.com> > >To: "'Ken Termiso'" <jerk_alert at 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 at stat.math.ethz.ch > > > [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Ken Termiso > > > Sent: Monday, October 03, 2005 9:41 AM > > > To: r-help at 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 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 > > > > > > > >------------------------------------------------------------- > --------- > >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. > > > >
Seemingly Similar Threads
- Problem building/checking library that requires input from user
- R CMD check: Uses the superseded package: ‘doSNOW’
- R CMD check: Uses the superseded package: ‘doSNOW’
- R CMD check: Uses the superseded package: ‘doSNOW’
- Rounding fractional numbers to nearest fraction