Re: [R] apply block of if statements with menu function

2014-09-22 Thread PIKAL Petr
Hi > -Original Message- > From: r...@openmailbox.org [mailto:r...@openmailbox.org] > Sent: Thursday, September 18, 2014 4:35 PM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: RE: [R] apply block of if statements with menu function > > On 2014-09-16

Re: [R] apply block of if statements with menu function

2014-09-18 Thread rl
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 explana

Re: [R] apply block of if statements with menu function

2014-09-16 Thread PIKAL Petr
ot;) > 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. Regards Petr > -Original Message- > From: r...@op

Re: [R] apply block of if statements with menu function

2014-09-16 Thread rl
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 no

Re: [R] apply block of if statements with menu function

2014-09-16 Thread PIKAL Petr
ards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of r...@openmailbox.org > Sent: Tuesday, September 16, 2014 11:10 AM > To: David L Carlson > Cc: r-help@r-project.org > Subject: Re: [R] apply block of i

Re: [R] apply block of if statements with menu function

2014-09-16 Thread rl
On 2014-09-15 14:22, David L Carlson wrote: I think switch() should work for you here, but it is not clear how much flexibility you are trying to have (different tests based on the first response; different tests based on first, then second response; different tests based on each successive respo

Re: [R] apply block of if statements with menu function

2014-09-15 Thread rl
On 2014-09-15 14:22, David L Carlson wrote: I think switch() should work for you here, but it is not clear how much flexibility you are trying to have (different tests based on the first response; different tests based on first, then second response; different tests based on each successive respo

Re: [R] apply block of if statements with menu function

2014-09-15 Thread David L Carlson
David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of r...@openmailbox.org Sent: Monday, September 15, 2014 3:53 AM To: r-help@r-project

[R] apply block of if statements with menu function

2014-09-15 Thread rl
Subscribers, apply block of if statements with menu function Subscribers, For a menu: menu(c('a','b','c','d')) How to create a function that will apply to specific menu choice objects? For example: object1<-function (menuifchoices) { menu1<-menu(c('a','b','c','d')) if (menu1==1)