2

I'm aware of, and have been looking at, renv. The issue is that when using renv with renv::init() it will scrape through the repo for any .R files and add them to the renv.lock, which is a (often large) json file.

If I want to add a package manually (such as styler or docopt) this isn't straightforward.

I disagree with this being closed

Just editing to state that, I think this would be a useful question to have answered

Note - I've added this back in, I also disagree with the previous edit of:

not accepting the answer of community is bad idea.

baxx
  • 3,956
  • 6
  • 37
  • 75
  • 1
    With [rstudio/renv#544](https://github.com/rstudio/renv/issues/554), you can add packages to a renv environment one by one: `renv::snapshot(packages = c("styler", "docopt"))`. You need `renv >= 0.12.0-22`, e.g. via `remotes::install_github("rstudio/renv")`. Also I don't think this is opinion-based and therefore I believe it should be re-opened. – Lorenz Walthert Nov 08 '20 at 23:25
  • You can also just add dependencies to the file `DESCRIPTION` manually or with `usethis::use_package()`. Then, anyone who uses your project (e.g. git via clone) can use `remotes::install_deps()` to install all required dependencies. This will not use a virtual environment but install them into the global/user library by default. – Lorenz Walthert Nov 08 '20 at 23:34
  • Thanks, i agree that this shouldn't be closed, and would like to use renv (not global) as I want to start using similar management for R as is done with Python envs. – baxx Nov 09 '20 at 00:46

0 Answers0