mylist <- list(demographic_vars, usage_engagement_vars, billing_contracttype_vars, contract_type_vars)
Each variable in mylist is a dataframe.
I'm writing a function to pass to lapply(). I would like to loop over mylist and name a variable like so:
varData <- function(x) {
paste('cv_prediction',x,sep='') <- data.frame()
}
Goal of the above would be this: (e.g. for the first iteration)
cv_predictiondemographic_vars <- data.frame()
I'm getting an error in my function that I suspect is related to the above.
Error in paste("cv_prediction", x, sep = "") <- data.frame() :
target of assignment expands to non-language object
If I want to create variables within my function that are the concatenation of the current value of x in a loop to some other string, how would I do that?
assignif you are creating a data.frame object