Ey up!
I’ve noticed that two, possibly three lock files seem to serve much of the same purposes. They all record the R version and what dependencies and their versions.
RStudio's renv docs suggests:
"For development and collaboration, the .Rprofile, renv.lock and renv/activate.R files should be committed to your version control system."
RStudio's Connect docs suggests:
“We recommend committing the manifest.json into your source control system and regenerating it whenever you push new versions of your code -- especially when updating packages or otherwise changing its dependencies!”
If we commit both lock files, it gives me a bit of a headache thinking what happens if folks regenerate renv.lock but not manfest.json, or manifest.json but not renv.lock, thereby getting us into messy setups.
It would be great if manifest.json could reference the renv.lock instead - “DRY” (Don’t Repeat Yourself) principles.
It gives me another headache that RStudio Connect's deployment process uses Packrat, (yet) another package management tool.
My question here is, what do you folks do when you deploy content items? If you only use manifest.json (not renv.lock) then how do you reproduce the environment on your local machine (rather than on RStudio Connect) using manifest.json? If you only use renv.lock then how do you deploy your content item without using manifest.json?
Any suggestions as to best practices in this area would be most welcome.
P.S if interested, below is a (much simplified) sample lockfile for each of the three tools for the same requirements
renv.lock:
{
"R": {
"Version": "4.1.3",
"Repositories": [
{
"Name": "CRAN",
"URL": "https://cran.rstudio.com"
}
]
},
"Packages": {
"arrow": {
"Package": "arrow",
"Version": "8.0.0",
"Source": "Repository",
"Repository": "CRAN",
...
manifest.json:
{
"platform": "4.1.3",
"packages": {
"arrow": {
"Source": "CRAN",
"Repository": "https://cran.rstudio.com/",
"description": {
"Package": "arrow",
"Version": "8.0.0",
...
packrat.lock:
RVersion: 4.1.3
Repos: CRAN=https://cran.rstudio.com/
Package: arrow
Source: CRAN
Version: 8.0.0