On 2014-09-10 10:45, PIKAL Petr wrote:

On 2014-09-08 15:47, William Dunlap wrote:
> d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4)
> i <- 1 # possible output of menu(unique(d$Choices))
> d[ d$Choices[i] == d$Choices, ]
> #  Choices X
> #1     One 1
> #3     One 3
>

> testd <- data.frame(Choices=c("One","Two","One","Three"), X=1:4)
> testi <- 1 # possible output of menu(unique(d$Choices))
> testd[ testd$Choices[testi] == testd$Choices, ]
   Choices X
1     One 1
3     One 3

This instruction did not give any opportunity to enter a choice? Then
tried:

Why do you think so? Did you try it? Follow Wiliam's advice

d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4)
i <- menu(unique(d$Choices))


It looks that you understood that 'menu...' was to be assigned to the variable 'i'; I did not understand, it was interpreted as a part of a comment, not a command to apply! :)

Of course, the menu function as you wrote it was successfully replicated. Thanks.


BTW, did you read R-intro? If not, why not?


Yes, but for the benefit of other novices, information about 'menu' is accessible via '?menu' within R, or via R command 'help.start()' and web browser hyperlinks: 'packages','utils','menu'.

______________________________________________
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