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:

?Choices
No documentation for 'Choices' in specified packages and libraries:
you could try '??Choices'

??Choices
Help files with alias or concept or title matching ‘Choices’ using
fuzzy matching:


mgcv::choose.k          Basis dimension choice for smooths
mvtnorm::GenzBretz      Choice of Algorithm and Hyper Parameters


Type '?PKG::FOO' to inspect entry 'PKG::FOO TITLE'.

Then I tried to use with my test data:

testdataextract1<-data.frame(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something'))
selectionresult<-2
testdata[testdata$menu[selectionresult]==testdata$menu,]
testdataextract1<-data.frame(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select something'))
Select something

1: text test1
2: text test2
3: text test3

Selection: selectionresult<-2
Enter an item from the menu, or 0 to exit
Selection: testdata[testdata$menu[selectionresult]==testdata$menu,]
Enter an item from the menu, or 0 to exit
Selection: 0

Now confused by "Choices"! :) What is my error please?

______________________________________________
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