Skip to content
Prev 294559 / 398503 Next

how to create a new data given a vector of variable names

I think you're making this too hard:

x[, vars]

should do it.

For a smaller example, consider

x <- data.frame(a = 1:5, b = rnorm(5), c = letters[1:5])

x[, c("b","a")]

Best,
Michael
On Tue, May 15, 2012 at 1:12 AM, christy <saunders.christy at ymail.com> wrote: