You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into the following problem where gbm does not find a predictor in the local environment:
do.gbm <- function(y,x){
require(gbm)
l <- x
o <- gbm(y~l)
}
x <- rnorm(100)
y <- x^2
do.gbm(y,x)
Produces
Error in eval(expr, envir, enclos) : object 'l' not found
It occurs at the following line (456), which looks for the variables within data rather than parent.frame():
x <- model.frame(terms(reformulate(var.names)),
data,
na.action=na.pass,
subset=subset)
A proposed solution could be to just select the predictors from mf using var.names computed the line before. mf should have all variables either in data or parent.frame. I've not tested this extensively.
x <- mf[,var.names,drop=F]
The text was updated successfully, but these errors were encountered:
Yes. It also has problems with gbm((fred > 0) ~ ., data=stuff). Fixing this is (in my head) kind of tied in with refactoring the R code to remove all the if else from gbm, gbm.fit, etc.
I ran into the following problem where
gbm
does not find a predictor in the local environment:Produces
It occurs at the following line (456), which looks for the variables within
data
rather thanparent.frame()
:A proposed solution could be to just select the predictors from
mf
usingvar.names
computed the line before.mf
should have all variables either indata
orparent.frame
. I've not tested this extensively.The text was updated successfully, but these errors were encountered: