[R] passing a vector of variable names to the ... pairlist function argument

Jessica Myers jmyers6 at PARTNERS.ORG
Thu Apr 21 16:03:15 CEST 2011


I have a character vector that contains the names of several objects  
that I would like to pass to a function (specifically, the ridge  
function in the survival package, but cbind is a similar example).   
I've been struggling with how to do this so that the object values get  
interpreted by the function, rather than the object names.

For example,
x1 <- 1:4
x2 <- 2:5
x3 <- 3:6
xs <- c("x1", "x2", "x3")

If I wanted to cbind(x1, x2, x3) without typing this out, how would I  
do it?

Thanks very much!

Jessica Myers
Instructor in Medicine
Division of Pharmacoepidemiology
Brigham and Women's Hospital

The information in this e-mail is intended only for the ...{{dropped:7}}

More information about the R-help mailing list