[R] function - access column

Ana rrasterr at gmail.com
Fri Oct 7 17:03:04 CEST 2011


How can I call matrix$col, inside a function?
The matrix name is one of the variables of the function, while the
column name I get by assuming that it should have a certain
characters.

something like this

function(matrix){
colname=as.name(grep("[A-T a-t]ting",colnames(matrix),value=TRUE))
output=2*(matrix$colname)
return(output)
}

The name of the column is Testing.



More information about the R-help mailing list