I want to be able to be able to create a new variable in a data.frame that is named based on an existing string. So, for example, if the new variable is Q7A what I have tried to do is the following:
question <- "Q7A"
Q <- parse( text = paste("data$", question, sep = ""))
eval(Q) <- 3
What I want this to be interpreted as is:
data$Q7A <- 3
But I get the following error message: Error in eval(Q) <- 3 : could not find function "eval<-"