On 2014-09-16 12:35, PIKAL Petr wrote:
So if result of menu is 0 (you did not choose anything) you can either stay with 0, then switch does not return anything or add 1 and let evaluate something meaningful specified in second and following positions of switch command.
Thanks for your explanation, which completed my understanding! :) For the benefit of other novices, below is an example to demonstrate how 'switch' and 'menu' can be used:
switch(menu(c(1,2),graphics=FALSE,title='select something'), {(seq(1:10))}, {(rnorm(20))})
However, how to make the option '0 to exit' to appear in the command terminal?
______________________________________________ R-help@r-project.org 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.