Select column dataframe index R -


i have data frame df this

1    2    3    4     b     c   

where colnames {1,2,3,4}. select 1 of column of data frame according index set externally

colf <- as.numeric(mo) fmo <- df[[colf]] 

many thanks,

treat data frame matrix , index using [row,column] notation, i.e.

fmo = df[,colf] 

this column number colf.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -