Dear All.,

I've created R-code for which a user will be asked to choose between 2
analyses.  I've written one function for each type of analysis.  Within
each function, the users is prompted to enter information.  An example
is:
 
cat("Enter value for lower Linf :\n")
     L1<-scan(n=1)
     cat("Enter value for upper Linf :\n")
     L2<-scan(n=1)
     cat("Enter Linf interval :\n")
     int_L<-scan(n=1)
     cat("Enter value for lower K :\n")
     K1<-scan(n=1)
     cat("Enter value for upper K :\n")
     K2<-scan(n=1)
     cat("Enter K interval :\n")
     int_K<-scan(n=1)

I thought I could evaluate and run the appropriate function at the end
of the program by:

if(event==1) explore() else evaluate()


If I run the whole program and either explore() or evaluate() is run,
the first four prompted entries are skipped over.  The console output
for event==1 is TRUE looks like:

> if(event==1) explore() else evaluate()
Enter value for lower Linf :
1: 
Read 0 items
Enter value for upper Linf :
1: 
Read 0 items
Enter Linf interval :
1:    
Read 0 items
Enter value for lower K :
1:     
Read 0 items
Enter value for upper K :
1:

I then tried another way.  I created    

runcase<-ifelse(event==1,"explore","evaluate")

At the bottom of the program I used:

eval(call(x=runcase))

But I still get the same problem.

Any suggestions?
 

Thanks for your help

Gary A. Nelson, Ph.D
Massachusetts Division of Marine Fisheries
30 Emerson Avenue
Gloucester, MA 01930
Phone: (978) 282-0308 x114
Fax: (617) 727-3337
Email: [EMAIL PROTECTED]

______________________________________________
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.

Reply via email to