r-package-development

Guide R package development with dependency management, API design, testing, and roxygen2 documentation.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/jhelvy/dotfiles --skill r-package-development-jhelvy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r-package-development
Source: https://github.com/jhelvy/dotfiles/tree/main/claude/skills/r-package-development
Command: npx skills add https://github.com/jhelvy/dotfiles --skill r-package-development-jhelvy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to developing high-quality R packages, ensuring best practices in dependency management, API design, testing, and documentation.

Core Features & Use Cases

  • Dependency Strategy: Guidance on when to use external packages versus base R, and how to specify them.
  • API Design: Patterns for creating user-friendly and robust function interfaces.
  • Testing & Documentation: Best practices for unit testing, snapshot testing, and generating documentation with roxygen2.
  • Use Case: A data scientist needs to create a reusable R package for a specific data analysis workflow and wants to ensure it's well-structured, maintainable, and easy for others to use.

Quick Start

Use the r-package-development skill to understand how to specify package dependencies in the DESCRIPTION file.

Frequently Asked Questions about r-package-development

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

FAQPage Schema
How do I specify R package dependencies in the DESCRIPTION file?

To specify R package dependencies in the DESCRIPTION file, you declare required external packages under the Imports or Depends fields, ensuring your package functions load correctly and maintain robust dependency management.

What is the best way to generate documentation for an R package?

The best way to generate R package documentation is using roxygen2 to write inline code comments, which automatically creates manual pages and ensures your API design is well-documented and easy for others to use.

How do I set up unit testing for an R library?

You set up unit testing for an R library by using the testthat framework to write and run test cases, ensuring code quality, verifying function interfaces, and preventing regressions during package development.

When should I use external packages versus base R for package development?

You should use external packages versus base R when an external library provides necessary functionality that simplifies API design and error handling, while relying on base R minimizes heavy dependency management for simpler tasks.

How do I design a user-friendly function interface for an R package?

To design a user-friendly function interface for an R package, you apply API design patterns that ensure robust parameter handling, clear error messaging, and intuitive function naming for maintainable R libraries.