r - Subset based on variable column name -


i'm wondering how use subset function if don't know name of column want test. scenario this: have shiny app user can pick variable on filter (subset) data table. receive column name webapp input, , want subset based on value of column, so:

subset(mydata, thecolumn == somevalue) 

except both thecolumn , somevalue variables. there syntax passing desired column name string?

seems want bareword column name, not variable holds column name.

this precisely why subset bad tool other interactive use:

d <- data.frame(x = letters[1:5],y = runif(5)) > d[d[,'x'] == 'c',]   x         y 3 c 0.3080524 

fundamentally, extracting things in r built around [. use it.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -