[R] rownames as parameter in functions
Johannes Schnitzler
schnitzlerj at gmx.de
Sun Feb 16 00:20:06 CET 2003
Dear all,
i want to give the names of columns of a data set (dat) as parameter to a
function,
in order to select single rows by the row names.
I tried several ways.
Like:
the data set :
dat
A B C D E
1 2 3 1 6
1 4 5 2 4
.. .. .. .. ..
the.col.names<-c("A","C")
f<-function(par){sapply,function(par)(dat$par*2)}
f(the.col.names)
Should give the result
A C
2 6
2 10
.. ..
Thank you in advance
Johannes Schnitzler
schnitzlerj at gmx.de
More information about the R-help
mailing list