Consider the following code
a = "col1"
b = "col2"
d = data.frame(a=c(1,2,3),b=c(4,5,6))
This code produces the following data frame
  a b
1 1 4
2 2 5
3 3 6
However the desired data frame is
  col1 col2
1 1    4
2 2    5
3 3    6
Further, I'd like to be able to do something like d$a which would then grab d$col1 since a = "col1"
How can I tell R that "a" is a variable and not a name of a column?
 
     
     
     
    