roxygen2 Documentation

Document R package functions, data, and packages using roxygen2 tags and Markdown.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/choxos/RPkgAgent --skill roxygen2-documentation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: roxygen2 Documentation
Source: https://github.com/choxos/RPkgAgent/tree/main/plugins/r-package-development/skills/roxygen2-documentation
Command: npx skills add https://github.com/choxos/RPkgAgent --skill roxygen2-documentation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to documenting R packages using roxygen2, ensuring your code is understandable, maintainable, and discoverable by users and other developers.

Core Features & Use Cases

  • Roxygen Tag Reference: Detailed explanations of essential tags like @param, @returns, @export, @examples, and more.
  • Markdown Integration: Learn how to use Markdown for rich text formatting, links, and code blocks within your documentation.
  • Data and Package-Level Docs: Understand how to document datasets and the package itself for a complete documentation suite.
  • Use Case: You've written a new R function and need to document it correctly for your package. This Skill will guide you through adding parameters, return values, examples, and export tags to generate professional .Rd files.

Quick Start

Use the roxygen2 documentation skill to learn how to document an R function with parameters and return values.

Frequently Asked Questions about roxygen2 Documentation

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

FAQPage Schema
How do I document an R package function using roxygen2?

To document R package functions with roxygen2, add code comments above the function definition using tags like @param for parameters, @returns for output values, and @export to generate the corresponding .Rd files automatically.

How do I document datasets and package-level information in R?

Documenting R package-level information and datasets requires adding specific roxygen2 tags to your scripts, which generates the necessary .Rd files to ensure your datasets and package overview are discoverable.

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

The best way to generate examples for R package documentation is using the @examples tag in roxygen2, which embeds executable R code directly within your code comments to demonstrate function usage.

What are the essential roxygen2 tags for R package documentation?

Essential roxygen2 tags for R package documentation include @param for arguments, @returns for outputs, @export for namespace control, and @examples for usage demonstrations.

Can I use Markdown for rich text formatting in R package documentation?

You can use Markdown for rich text formatting in R package documentation by enabling Markdown support in roxygen2, allowing you to add links, lists, and code blocks within your code comments.