r-dependencies

Manages R package dependencies using renv lockfiles and DESCRIPTION conventions.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/chris-prener/dev-kit --skill r-dependencies-chris-prener
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: r-dependencies
Source: https://github.com/chris-prener/dev-kit/tree/main/dev-kit/skills/r-dependencies
Command: npx skills add https://github.com/chris-prener/dev-kit --skill r-dependencies-chris-prener

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? R projects often suffer from inconsistent package versions across machines, unclear Imports versus Suggests placement, and broken renv lockfiles. This Skill defines a disciplined workflow for adding, updating, and troubleshooting R dependencies so environments stay reproducible. ## Core Features & Use Cases - renv lifecycle management: Covers init, install, snapshot, restore, update, remove, status, and clean operations with guidance on when to use each. - DESCRIPTION conventions: Enforces correct Imports/Suggests separation, minimum version bounds, alphabetization, and formatting rules. - Version pinning strategy: Distinguishes exact pins in renv.lock from minimum bounds in DESCRIPTION, including Bioconductor and GitHub sources. - Troubleshooting table: Maps common failures like restore errors, lockfile drift, and binary/source conflicts to concrete fixes. - Use Case: When adding the arrow package for parquet I/O, follow the five-step workflow to install it, register it in DESCRIPTION via usethis, snapshot the lockfile, verify with renv::status(), and commit both files with a conventional deps message. ## Quick Start Ask Claude to add the arrow package to your R project dependencies and update the renv lockfile.

Frequently Asked Questions about r-dependencies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new package to an R project with renv?▼

Install the package with renv::install(), register it in DESCRIPTION using usethis::use_package() with the appropriate type, then run renv::snapshot() to update the lockfile. Verify with renv::status() and commit both DESCRIPTION and renv.lock together.

What is the difference between Imports and Suggests in DESCRIPTION?▼

Imports lists packages required at runtime, such as dplyr or DBI, while Suggests holds dev-only packages like testthat, lintr, and covr. Avoid Depends except for declaring the R version constraint itself.

Should I pin exact versions in DESCRIPTION or renv.lock?▼

Pin exact versions in renv.lock, which is renv's default behavior for reproducibility. In DESCRIPTION, use minimum bounds like dplyr (>= 1.1.0) rather than exact pins, and pin the R version via Depends: R (>= 4.1.0).

Why does renv::restore() fail on a fresh clone?▼

Restore failures usually come from an R version mismatch with the lockfile or missing compiled package builds. Check that your R version matches the lockfile and run renv::rebuild() for compiled packages.

Can renv install Bioconductor or GitHub packages?▼

Yes, use renv::install("bioc::PackageName") for Bioconductor and renv::install("owner/repo") for GitHub packages; both are recorded in the lockfile. You can also pin a Bioconductor release via renv::init(bioconductor = "3.18").

When should I not use this dependency workflow?▼

This workflow does not cover initial project scaffolding, CI caching of renv libraries, or package NAMESPACE management. Those concerns belong to project setup, CI configuration, and package structure conventions respectively.