[R] Using a variable in the formula
jmark17
bjmethari at gmail.com
Tue Oct 27 04:26:48 CET 2009
I am sure this question has come up, but searching hasn't given me any
results.
So I need to enter this line:
mx1 <- randomForest(X1 ~ elevation + slope + vegtype, data = moths.train)
But the problem is that X1 is currently hard coded. I would instead like to
be able to put in the value of X1 through a list. For example:
list <- list("X1", "X2", "X3")
#Then, instead of X1, I want to put list[1]
mx1 <- randomForest(list[1] ~ elevation + slope + vegtype, data =
moths.train)
randomForest does not accept list[1] as a valid entry, so how can I get it
to accept it as X1, instead of list[1]?
Thanks
--
View this message in context: http://www.nabble.com/Using-a-variable-in-the-formula-tp26071598p26071598.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list