r-docs
Access R package documentation and learn about packages. Use when exploring packages, finding function help, or understanding package capabilities.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Access R package documentation and learn about packages. Use when exploring packages, finding function help, or understanding package capabilities.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Write R code following tidyverse style guide. Use when writing R functions, scripts, or any R code.
Explore and inspect R data frames, objects, and environments interactively. Use when the user wants to understand data structure, preview data, or investigate R objects.
Develop R packages following best practices. Use when creating packages, writing package functions, documentation, or tests.
rlang metaprogramming patterns for data-masking, injection operators, and dynamic dots. Use when writing functions that use tidy evaluation.
| name | r-docs |
| description | Access R package documentation and learn about packages. Use when exploring packages, finding function help, or understanding package capabilities. |
How to discover and access R package documentation.
Always use these btw MCP tools first — they provide direct access to R documentation without running R code:
| Tool | Purpose |
|---|---|
btw_tool_docs_help_page | Get help page for a function (?pkg::fun) |
btw_tool_docs_package_help_topics | List all help topics in a package |
btw_tool_docs_available_vignettes | List vignettes for a package |
btw_tool_docs_vignette | Read a vignette in plain text |
btw_tool_docs_package_news | Read package NEWS/changelog |
btw_tool_cran_search | Search for packages on CRAN |
btw_tool_cran_package | Describe a CRAN package |
Only fall back to R commands below if btw tools are unavailable.
| Task | Command |
|---|---|
| Function help | ?dplyr::filter or help("filter", package = "dplyr") |
| Package overview | help(package = "dplyr") |
| List vignettes | vignette(package = "dplyr") |
| Open vignette | vignette("dplyr", package = "dplyr") |
| Search docs | help.search("linear model") or ??linear |
| Function args | args(dplyr::filter) |
| Function source | dplyr::filter (print without parens) |
| Package news | news(package = "dplyr") |
# Help for a specific function
?dplyr::filter
help("filter", package = "dplyr")
# See function arguments
args(dplyr::filter)
# See function source code
dplyr::filter
getAnywhere("filter")
# Find methods for a generic
methods("print")
methods(class = "data.frame")
# List all functions in a package
help(package = "dplyr")
# List exported functions
ls("package:dplyr")
getNamespaceExports("dplyr")
# Package description
packageDescription("dplyr")
# Package version
packageVersion("dplyr")
# Package dependencies
tools::package_dependencies("dplyr")
Vignettes are long-form documentation with examples:
# List available vignettes
vignette(package = "dplyr")
browseVignettes("dplyr")
# Open a specific vignette
vignette("dplyr", package = "dplyr")
vignette("programming", package = "dplyr")
# Search across all installed packages
help.search("linear model")
??linear
# Search for functions by name pattern
apropos("mean")
apropos("^str") # starts with "str"
# Find which package a function belongs to
find("filter")
getAnywhere("filter")
Most tidyverse and r-lib packages have pkgdown sites:
https://<pkg>.r-lib.org/ or https://<org>.github.io/<pkg>/# Open CRAN page in browser
browseURL(paste0("https://cran.r-project.org/package=", "dplyr"))
CRAN pages include:
Find source code and issues:
# Package URL (if set in DESCRIPTION)
packageDescription("dplyr")$URL
packageDescription("dplyr")$BugReports
# List datasets in a package
data(package = "ggplot2")
# Load a dataset
data("mpg", package = "ggplot2")
# List all objects (including internal)
ls(getNamespace("dplyr"))
# Check if function is exported
"filter" %in% getNamespaceExports("dplyr")
# See default argument values
formals(dplyr::filter)
# Check if function is S3 generic
pryr::is_s3_generic("print")
sloop::is_s3_generic("print")
# Find S3 method for a class
getS3method("print", "data.frame")
sloop::s3_dispatch(print(mtcars))
# See all methods for a generic
methods("print")
sloop::s3_methods_generic("print")
| Package | Purpose |
|---|---|
sloop | Understand S3/S4 OOP |
pryr | Inspect R internals |
lobstr | Visualize data structures |
pkgapi | Extract package API |
install.packages()library() just to access help (use ?pkg::fun instead)