Creating formula using very long strings in R
问题 I'm in a situation where I have a vector full of column names for a really large data frame. Let's assume: x = c("Name", "address", "Gender", ......, "class" ) [approximatively 100 variables] Now, I would like to create a formula which I'll eventually use to create a HoeffdingTree . I'm creating formula using: myformula <- as.formula(paste("class ~ ", paste(x, collapse= "+"))) This throws up the following error: Error in parse(text = x) : :1:360: unexpected 'else' 1:e+spread+prayforsonni+just