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

From: Jessica Myers <jmyers6_at_PARTNERS.ORG>
Date: Thu, 21 Apr 2011 10:03:15 -0400


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}}

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 21 Apr 2011 - 14:46:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Apr 2011 - 15:10:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive