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

Ken Termiso jerk_alert at hotmail.com
Mon Oct 3 15:41:05 CEST 2005


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




More information about the R-help mailing list