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)
        ...
        menu1a<-menu...
                if (menu1a==1)
                ...
        menu2a<-menu...
                if (menu2a==1)
                ...
menu2
        <-menu(c('a','b','c','d'))
        if (menu1==2)
        ...
}

The request action is that a user can select a menu option that will activate a series of "multiple choice" questions, results in "menu1" being activated without menu2 being activated. If someone could direct to the relevant terminology, thank you.

Separate question; for a menu:

menu(c('a','b','c','d'))

1: a
2: b
3: c
4: d

Selection: 1
[1] 1

is it possible to change behaviour so that result of the selection is not the integer, but the original menu choice:

Selection: 1
[1] a

______________________________________________
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.

Reply via email to