I am creating parameterized reports and the choices of my params are coming from an R code which requires loading libraries.
When I run my code locally, it works fine even I load the libraries after the yaml part, however when I publish the RMD in RStudio Connect, I get a library error because RStudio Connect doesn't see the libraries.
You can definitely reference code from packages in the params section of an R Markdown document. Have you tried using !r mypackage::myfunction() as the parameter value? The package has not been loaded with a library statement; its contents are not yet part of the environment.
Try something like this:
---
title: rmd with parameter that has a library dependency
params:
hello: !r mypackage::myfunction()
---
yes. we have a dependency. `r params$hello`