Are install.package checks necessary with renv?

Hello,
I am working on a project where I've installed renv, and run init() in the project folder.
In the header section of our code we have the following workflow:

#list of necessary pacakges 
listOfPackages <- c('tidyverse', 'lubridate', 'renv', 'etc')
#loop to load packages, and install if not installed previously
## remember: if you add a package, then you have to run renv::snapshot() to add it to the lockfile
for (i in listOfPackages){
  if(! i %in% installed.packages()){
    install.packages(i, dependencies = TRUE)
  }
  #load packages
  library(i, character.only = TRUE)
}

I know this workflow is mentioned as not visible for renv, but my question is do we need to run the install.packages step at all anymore if we're relying on renv?

Thanks!

If the renv project is activated, or you manually use renv restore, then renv handles all installation without need of that code.
You will need tooad libraries into the session though

This topic was automatically closed 21 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.