-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression as actual expression (with environment) or quosure? #2
Comments
This was reraised during MCMC athon and is now a priority. |
Need to retain ability to work with old strings. |
Reprex to see which code is seeing options(conflicts.policy = list(warn = FALSE))
devtools::load_all(".")
#> ℹ Loading mcmcrtesting
sbf_set_sub("count")
analysis <- sbf_load_object("analysis")
#> Registered S3 method overwritten by 'rjags':
#> method from
#> as.mcmc.list.mcarray mcmcr
sbf_load_datas()
# slow part appears to be under within.list | eval | res_gamma_pois
# cbind/vectorized with residual ----
# this is fast and getting to where we want
mcmc_derive_data(
analysis,
new_data = data,
new_expr = "
rlang::abort('Just for testing')
log(eCount) <- b0 + bYear * Year + bKelpLine * KelpLine + bSite[Site] + bAnnual[Annual] + bSiteAnnual[cbind(Site, Annual)]
log(eCountKelpline) <- b0 + bKelpLine + bYear * Year + bAnnual[Annual] + bSite[Site] + bSiteAnnual[cbind(Site,Annual)]
log(eCountBarren) <- b0 + bYear * Year + bAnnual[Annual] + bSite[Site] + bSiteAnnual[cbind(Site,Annual)]
prediction <- eCountKelpline * 0.25 + eCountBarren * 0.75
residual <- res_gamma_pois(Count, fit, sSiteAnnualQuadrat)
"
)
#> Error:
#> ! Just for testing
#> Backtrace:
#> ▆
#> 1. ├─mcmcdata::mcmc_derive_data(analysis, new_data = data, new_expr = "\n rlang::abort('Just for testing')\n log(eCount) <- b0 + bYear * Year + bKelpLine * KelpLine + bSite[Site] + bAnnual[Annual] + bSiteAnnual[cbind(Site, Annual)]\n log(eCountKelpline) <- b0 + bKelpLine + bYear * Year + bAnnual[Annual] + bSite[Site] + bSiteAnnual[cbind(Site,Annual)]\n log(eCountBarren) <- b0 + bYear * Year + bAnnual[Annual] + bSite[Site] + bSiteAnnual[cbind(Site,Annual)]\n prediction <- eCountKelpline * 0.25 + eCountBarren * 0.75\n\n residual <- res_gamma_pois(Count, fit, sSiteAnnualQuadrat)\n")
#> 2. └─mbr:::mcmc_derive_data.mb_analysis(...)
#> 3. ├─mcmcderive::mcmc_derive(...)
#> 4. └─mbr:::mcmc_derive.mb_analysis(...) at mcmcderive/R/mcmc-derive.R:34:2
#> 5. └─mbr:::mcmc_derive_fun(...)
#> 6. ├─mcmcderive::mcmc_derive(...)
#> 7. └─mcmcderive:::mcmc_derive.mcmcr(...) at mcmcderive/R/mcmc-derive.R:34:2
#> 8. └─mcmcderive:::split_apply_combine(...) at mcmcderive/R/mcmc-derive.R:117:2
#> 9. └─base::lapply(...) at mcmcderive/R/internal.R:167:4
#> 10. └─mcmcderive (local) FUN(X[[i]], ...)
#> 11. └─base::lapply(...) at mcmcderive/R/internal.R:146:2
#> 12. └─mcmcderive (local) FUN(X[[i]], ...)
#> 13. ├─base::within(object, eval(expr)) at mcmcderive/R/internal.R:137:2
#> 14. └─base::within.list(object, eval(expr))
#> 15. └─base::eval(substitute(expr), e)
#> 16. └─base::eval(substitute(expr), e)
#> 17. ├─base::eval(expr)
#> 18. │ └─base::eval(expr)
#> 19. └─rlang::abort("Just for testing") Created on 2023-05-25 with reprex v2.0.2 |
This was referenced May 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mbr:::mcmc_derive.mb_analysis()
andmbr:::mcmc_derive_fun()
: use{{ new_expr }}
instead ofnew_expr
The text was updated successfully, but these errors were encountered: