m=as.data.frame(outer(1:5,6:9))
colnames(m)=c('a','b','c','d')
tf=function(df, col){list(mean(eval(substitute(col),df,parent.frame())),col
)}
tf(m,a) will issue error: Error in tf(m, a) : object 'a' not found
How can I replace the col as char 'a' in the function?
Thank you
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.