This vignette demonstrates how to use the
risk_assess_pkg() and assess_pkg_r_package()
functions from the risk.assessr package to assess the risk
of R packages.
You can assess:
.tar.gz source package (by upload and using
path)renv.lock fileTo assess your own package:
Use RStudio: Build > More > Build Source Package
to generate a .tar.gz file.
If using a web interface or app built on top of the risk engine,
upload the .tar.gz file through the UI.
# Assess a local .tar.gz R package by tar file upload
# risk_result <- risk_assess_pkg()
# OR by providing a path
risk_result <- risk_assess_pkg(path/to/my/package)
You can assess risks for all packages defined in an
renv.lock or pak.lock file. This is helpful
for auditing projects.
# Assess based on renv.lock
risk_result <- risk_assess_pkg("path/to/project/with/renv.lock") # or pak.lock
Note: This can be slow and is it better to run as a batch job or in CI (e.g., GitHub Actions).
Use this method to check a remote package and version directly from public repositories.
risk_result <- assess_pkg_r_package("stringr")
risk_result <- assess_pkg_r_package("stringr", version = "1.5.0")
These functions provide a consistent interface to assess risk for:
You can extend functionality by passing a custom
risk_config to override default.
See more Here