Re: [R] interactive menu in scripts

2008-01-26 Thread Henrique Dallazuanna
On 26/01/2008, WCD <[EMAIL PROTECTED]> wrote: > > Yes, the switch function works fine. > To store generated values in some variable I just use: > switch(menu(c("Normal", "Uniform")), a<-rnorm(5), a<-runif(5)) > > But why does not work this? (I know there is waste of variables, but in > principle)

Re: [R] interactive menu in scripts

2008-01-26 Thread WCD
Yes, the switch function works fine. To store generated values in some variable I just use: switch(menu(c("Normal", "Uniform")), a<-rnorm(5), a<-runif(5)) But why does not work this? (I know there is waste of variables, but in principle): b<-numeric(10) switch(menu(c("Normal", "Uniform")),

Re: [R] interactive menu in scripts

2008-01-26 Thread Henrique Dallazuanna
Try like this: switch(menu(c("Normal", "Poisson")), rnorm(5), rpois(5, 3)) On 25/01/2008, WCD <[EMAIL PROTECTED]> wrote: > > Hello, I would like to make my R script more interactive. Well, I want the > script to work like this: > > I run the script from R Console and it offers me some options (p

Re: [R] interactive menu in scripts

2008-01-26 Thread MichaƂ Bojanowski
Hi, Not going into the reason why would you like to do such a thing anyway, I would suggest: 1. Creating an R file that would contain all the functionality coded in functions. 2. The only executed code would be a function that calls the menu() and executes the appropriate functions. Sources o

[R] interactive menu in scripts

2008-01-25 Thread WCD
Hello, I would like to make my R script more interactive. Well, I want the script to work like this: I run the script from R Console and it offers me some options (press 1 for something, or press 2 for something else). After pressing 1 or 2, do corresponding procedure. I am not able to find out