Graphs showing in my app but not after deployment

Hi all,
I am trying to deploy my app and I am having a error messenger in one of my graphs, that is not present when I run the app locally.
I checked the logs and I can see the following error messenger: Error in gg_par: could not find function "gg_par". I make sure that the library(ggpubr) is running.

not sure what to do to fix the issue, does anyone know what would be the problem?

Thanks in advance.

Thanks in advance

Without knowing exactly how your project/the deployment is set-up, it's hard to say for sure. Is this set-up as a package with an included Shiny app?

In any case, you could try namespacing the gg_par function call i.e. ggpubr::gg_par() in all locations that it is used, and either make sure {ggpubr} is included in the DESCRIPTION file (if you're building an R package) or use the {renv} package manager to make sure the {ggpubr} package is included as a dependency + installed when the app is deployed.

Hi pcall,
Thank you so much for your reply.
I was able to fix it, the issue was that the type of graph I was trying to plot is from a github repository, so I only need to add this in Dockerfile beside other dependencies

R -e "install.packages('remotes')" &&
R -e "remotes::install_github('ricardo-bion/ggradar')"

Are you using {renv} with the project? That should allow you to avoid using an explicit installation step for all packages

Hi pcall,

thank you very much for your answer,
nop, I did not!
I will investigate a bit more to learn how to set it up!

Thanks again

It should be as simple as downloading the {renv} package, and then running renv::init(). If you add more packages later or need to update the versions, just run snapshot().

One thing to look out for, however, is that the version of R you're using locally for this project matches the version of R available on your deployment server.

If you're deploying e.g. to ShinyApps.io then the version of R available there is generally the latest R version (although sometimes it's latest-1.)