Indirect accessing of data frame variable in R -


i have r data.frame object called x. r console when str(x), following get.

str (x)

'data.frame':   2776 obs. of  4 variables:    $ date   : factor w/ 4018 levels "2003-01-01","2003-01-02",..: 1 6 11 16 21 26 31 36 41 46 ...   $ sulfate: num  na na na na na na na na na na ...   $ nitrate: num  na na na na na na na na na na ...   $ id     : int  1 1 1 1 1 1 1 1 1 1 ... 

i want access values related particular variable. in process when x.$nitrate values corresponding variable (ie nitrate) when following

> frame_variable <- "nitrate" 

and then do

> x$frame_variable null 

this limitation prohibiting me use feature in function i'm trying create. here.

thanks.

this way access columns variable:

x[, frame_variable] 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -