for example I have data frame m as below:

m=as.data.frame(outer(1:5,6:9))
colnames(m)=c('a','b','c','d')

and I define the function

myf=function(df, colname){

   suppose colname is a, then:
   how can I get the column 'a'
   and how to get the colname as a string, 'a'

}

Thank you!

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to