Specify R dependencies for Connect Cloud

A dependency file is required to let Connect Cloud know which R libraries to include in a given deployment. Any content that has R code needs either a manifest.json file or an renv renv.lock file included in the GitHub repository.

Connect Cloud captures everything it needs from the dependency file, including the packages and R version.

Note

What if I have both files?

If both manifest.json and renv.lock are present, Connect Cloud uses manifest.json and ignores renv.lock. If you manage your project with renv, you can delete manifest.json and Connect Cloud will use renv.lock instead.

Use renv.lock

If your project uses renv, Connect Cloud can read the packages from your renv.lock file. Generate renv.lock with renv 1.1.0 or later. To start using renv and create the file, run this in the R console from your project folder:

renv::init()

After you install or update packages, save the changes to the file:

renv::snapshot()

Connect Cloud can install packages that renv.lock records from package repositories such as CRAN or Posit Package Manager, Bioconductor, and GitHub, GitLab, Bitbucket, or other Git repositories. Packages from other sources, such as local files, cause the deployment to fail.

Make sure the repository does not also contain a manifest.json file. If it does, Connect Cloud uses manifest.json and ignores renv.lock.

Use manifest.json

Create a manifest.json file with the rsconnect package.

rsconnect::writeManifest()

Websites and Bookdown

If you are deploying Quarto websites, R Markdown websites, or Bookdown documents, set the contentCategory argument to site.

rsconnect::writeManifest(contentCategory = "site")

File location

Put the manifest.json or renv.lock file in the same directory as the primary file (for example, app.R or report.Rmd).

Private packages

Connect Cloud allows you to use your R packages published to private GitHub repositories. This feature requires a paid plan that includes private GitHub capability. These steps use a manifest.json file.