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
The NSE for trending:::fit.list() is broken when used programatically (i.e within functions). I think it is something to do with passing the correct environment around for evaluation but it's tricky.
library(trending)
# this worksx= rnorm(100, mean=0)
y= rpois(n=100, lambda= exp(1.5+0.5*x))
dummy<-data.frame(x=x, y=y)
poisson_model<- glm_model(y~x , family=poisson)
# this works
fit(poisson_model, data=dummy)
#> <trending_fit_tbl> 1 x 3#> result warnings errors#> <list> <list> <list>#> 1 <glm> <NULL> <NULL># this worksfun1<-function(xx) fit(poisson_model, data=xx)
fun1(dummy)
#> <trending_fit_tbl> 1 x 3#> result warnings errors#> <list> <list> <list>#> 1 <glm> <NULL> <NULL># this works
fit(list(pm=poisson_model), data=dummy)
#> <trending_fit_tbl> 1 x 4#> model_name result warnings errors #> <chr> <named list> <named list> <named list>#> 1 pm <glm> <NULL> <NULL># this does not workfun2<-function(xx) fit(list(pm=poisson_model), data=xx)
(out<- fun2(dummy))
#> <trending_fit_tbl> 1 x 4#> model_name result warnings errors #> <chr> <named list> <named list> <named list>#> 1 pm <NULL> <NULL> <chr [1]>out$errors#> $pm#> [1] "object 'xx' not found"
The NSE for
trending:::fit.list()
is broken when used programatically (i.e within functions). I think it is something to do with passing the correct environment around for evaluation but it's tricky.Created on 2023-04-14 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: