Automation of R code execution, from a project that makes use of renv

I use the way described here to automate the execution of r scripts. However, in a specific project I use renv, because there are specific dependencies that are needed (older packages that do not exist in default r installation).
Can I automate the execution of r scripts from that project, without ruining my default r installation?

Hi,

If you have specific package versions you like to use, you can set the path to them when loading them in your script:

library(package1, lib.loc="~/lib/package1/v1") 

Hope this helps,
PJ

Thanks. But, if I can't use renv::restore, I guess there is no reason to use renv in the first place.

If your scripts are set up as projects, i.e. have their own folder structures. Why wouldn't using renv and restore work unproblematically ?

You would almost certainly benefit from setting a shared renv cache though, for speed/efficiency reasons

1 Like

Because I don't know how to use renv outside of rstudio.

Hi,

Would this help?

So you have to run a script (or line of command line code) to call the script you like to run in renv from what I understand.

PJ

1 Like

This is probably exactly what I'm looking for. But why is it not in the reference ?

probably human oversite. run was previously an un-exported function, that became an exported function in 2019, and it was missed out of the reference documentation.

You could probably raise an issue- Issues ยท rstudio/renv (github.com)
asking for run to be included in the reference - I suspect this would be a minor edit of the _pkgdown.yml file

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.