[R] apply block of if statements with menu function

rl at openmailbox.org rl at openmailbox.org
Tue Sep 16 14:16:30 CEST 2014


On 2014-09-16 10:50, PIKAL Petr wrote:
> 
>> switch(menu(c("List letters", "List LETTERS")) + 1,
>>       cat("Nothing done\n"), letters, LETTERS)
>> 
>> why is the result changed if ' + 1,' removed?
> 
> Because +1 belongs to switch not to menu. You can translate above to:
> 

The help pages ?switch, ?menu do not describe (in my eyes! :) ) the 
significance of '+ 1'; where is this described in more detail please?



More information about the R-help mailing list