> testdataextract1<-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select > something'))
The switch function does not work the way you are expecting it to. Read help("switch") and read the introduction to R that comes with R. You probably want to use the output of menu() to extract a row of testdata with testdata[outputOfMenu,]. (How could testdataextract1 contain anything in the 2nd or 3rd columns of testdata if the expression producing testdataextract1 does not contain any reference to that column?) Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Sep 6, 2014 at 6:14 AM, <r...@openmailbox.org> wrote: > On 2014-09-05 09:40, r...@openmailbox.org wrote: >> >> Subscribers, >> >> Could someone please indicate correct terminology and relevant manual >> sections to achieve the following conceptual workflow, to create a >> script to select sequentially parts of a dataframe: >> >>> "Welcome to this R script program" >>> Select level number below of variable 'X' >> >> [1] >> [2] >> [3] >>> >>> 3 >>> Select level number below of variable 'Y' >> >> [1] >> [2] >>> >>> 1 >>> Summary >> >> X, [2] 'descriptive text A for level 3 selected' >> [1] 'descriptive text B for level 1 selected' >>> >>> Display graph? Y/N >>> y >>> [specific selected script activated, graph displayed] >> >> >> Thanks in advance. >> >> -- >> N.B. digest mode subscriber; please cc message. > > > For a test csv file: > > variablea,variableb,variablec > "text test1","other textx",100 > "text test2","other texty",200 > "text test3","other textz",400 > > Tried the following: > > testdata<-read.csv('test.csv') > testdataextract1<-switch(menu(c(unique(levels(testdata[,1]))),graphics=FALSE,title='Select > something')) > > Select something > > 1: text test1 > 2: text test2 > 3: text test3 > > Selection: 1 >> >> testdataextract1 > > NULL > > The requested output is: > > "text test1","other textx",100 > > Why is the result 'NULL'? > > ______________________________________________ > 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. ______________________________________________ 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.