Skip to content
Prev 75585 / 398503 Next

randomForest Error passing string argument

mmv wrote:

            
I really don't understand why you want it as a character.
I think you probably want to generate arguments dynamically and specify 
them in form of a list, which leads to constructions using do.call() at 
the end.

Anyway, if you really want to call randomForest with the abouve text, I 
guess this is one of tzhe few circumstances where you can do 
eval(parse(.....)):

state <- paste("fruit ~", "apples+oranges+blueberries,",
   "data=fruits.data, mtry=2, do.trace=100, na.action=na.omit,
    keep.forest=TRUE")
the_call <- paste("randomForest(", state, ")")
eval(parse(text=the_call))

Uwe Ligges