SaintRod / multi-lang-project-template

A language agnostic data analysis project template
MIT License
1 stars 1 forks source link

R project environments #4

Closed SaintRod closed 2 weeks ago

SaintRod commented 2 weeks ago

Based on the proposed idea from PR.

When -l r and -p path are specified, then:

  1. install renv in the base r env to nudge users to use project environments
  2. initialize the project environment
  3. install usethis
  4. call usethis::create_project(path = '.', rstudio=TRUE, open=FALSE) to programmatically create an .Rproj file
SaintRod commented 2 weeks ago

@jibarozzo, please take a look and let me know what you think. I tested this on my machine, and it works. The only noteworthy thing is that installing usethis for the first time can be a bit slow.

jibarozzo commented 2 days ago

I read more on how renv works and this is the best solution. I was confused about how renv worked. After their initial installation the package is stored in ~/.cache/R/renv/ not the base R library. Any new project that uses the same package gets linked to the one stored in the cache. This speed up "installation" of the package.

SaintRod commented 2 days ago

I read more on how renv works and this is the best solution. I was confused about how renv worked. After their initial installation the package is stored in ~/.cache/R/renv/ not the base R library. Any new project that uses the same package gets linked to the one stored in the cache. This speed up "installation" of the package.

Great investigative work. I knew packages installed via renv::install() were stored in cache but not renv itself. So installing usethis the first time will be slow but subsequent installations will be faster because of caching.