Let's say that I have a data frame that looks like the following.
dt = data.frame(a = rnorm(5), b = rnorm(5))
I would like to assign a set of column variables as a vector.
colvec <- c("a","b")
So for these two columns in the vector, I'd like to dynamically take that column and create a vector of the same name.
So the normal way to do this would be to do...
a = dt$a
b = dt$b
But I want to do this dynamically. Any suggestions?