[R] Reference to dataframe and contents

Rene Braeckman RMan54 at cox.net
Sun Feb 4 21:42:46 CET 2007


This is probably easy for experienced users but I could not find a solution.
 
I have several R scripts that process several columns of a dataframe
(several dataframes and columns actually, but simplified for my question).

References such as:
 
myDF$myCol
 
are all over. I like to automate this for other dataframes and columns by
defining a reference only once in the beginning of the script.

One idea is to use strings:

s1 <- "myDF"
S2 <- "myCol"

My question is how to construct the equivalent of myDF$myCol that can be
used as such. Or is there a better solution?

Thanks. The help and discussions on this forum are the best.
Rene
-----------------------------------------
Rene Braeckman, PhD
Clinical Pharmacology & Pharmacometrics
Irvine, California, USA



More information about the R-help mailing list