[R] sequential input script dataframe process functionality

rl at openmailbox.org rl at openmailbox.org
Sat Sep 6 15:14:44 CEST 2014


On 2014-09-05 09:40, rl at 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'?



More information about the R-help mailing list