[R] Calling an arbitrarily named data frame + variable

Jonathan Greenberg jgreenberg at arc.nasa.gov
Wed Nov 1 23:06:46 CET 2006


If I want to pass a data frame variable name and a specific component name
of the data frame to a function, and I want the function to operate on this
(e.g. Data frame = "data1" and the component in question is "component1", so
I want the function to operate on data1$component1), how do I pass and call
this info?  This would be for an arbitrarily named data frame and component
name, e.g. The function should also be able to handle it if I pass data2 and
component2, e.g. function1 <- function(dataframename,componentname) {} ...
function1("data2","component2")

--j

-- 
Jonathan A. Greenberg, PhD
NRC Research Associate
NASA Ames Research Center
MS 242-4
Moffett Field, CA 94035-1000
Office: 650-604-5896
Cell: 415-794-5043
AIM: jgrn307
MSN: jgrn307 at hotmail.com



More information about the R-help mailing list