[R] R programming question

From: Nelson, Gary (FWE) <Gary.Nelson_at_state.ma.us>
Date: Thu, 14 Jun 2007 11:02:13 -0400

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")

     cat("Enter value for upper Linf :\n")
     cat("Enter Linf interval :\n")
     cat("Enter value for lower K :\n")
     cat("Enter value for upper K :\n")
     cat("Enter K interval :\n")

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 :
Read 0 items
Enter value for upper Linf :
Read 0 items
Enter Linf interval :
Read 0 items
Enter value for lower K :
Read 0 items
Enter value for upper K :

I then tried another way. I created


At the bottom of the program I used:


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: Gary.Nelson_at_state.ma.us

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 and provide commented, minimal, self-contained, reproducible code. Received on Thu 14 Jun 2007 - 15:34:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Jun 2007 - 17:31:59 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.