| name | r-docs |
| description | Access R package documentation and learn about packages. Use when exploring packages, finding function help, or understanding package capabilities. |
R Documentation
How to discover and access R package documentation.
BTW MCP Tools (Preferred)
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.
Quick Reference
| 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") |
Function Documentation
?dplyr::filter
help("filter", package = "dplyr")
args(dplyr::filter)
dplyr::filter
getAnywhere("filter")
methods("print")
methods(class = "data.frame")
Package Overview
help(package = "dplyr")
ls("package:dplyr")
getNamespaceExports("dplyr")
packageDescription("dplyr")
packageVersion("dplyr")
tools::package_dependencies("dplyr")
Vignettes
Vignettes are long-form documentation with examples:
vignette(package = "dplyr")
browseVignettes("dplyr")
vignette("dplyr", package = "dplyr")
vignette("programming", package = "dplyr")
Searching Documentation
help.search("linear model")
??linear
apropos("mean")
apropos("^str")
find("filter")
getAnywhere("filter")
Online Resources
pkgdown Sites
Most tidyverse and r-lib packages have pkgdown sites:
- Pattern:
https://<pkg>.r-lib.org/ or https://<org>.github.io/<pkg>/
- Examples:
CRAN Pages
browseURL(paste0("https://cran.r-project.org/package=", "dplyr"))
CRAN pages include:
- Reference manual (PDF)
- Vignettes
- NEWS
- Dependencies
- Reverse dependencies
GitHub/GitLab
Find source code and issues:
packageDescription("dplyr")$URL
packageDescription("dplyr")$BugReports
Exploring Package Contents
data(package = "ggplot2")
data("mpg", package = "ggplot2")
ls(getNamespace("dplyr"))
"filter" %in% getNamespaceExports("dplyr")
Understanding Function Behavior
formals(dplyr::filter)
pryr::is_s3_generic("print")
sloop::is_s3_generic("print")
getS3method("print", "data.frame")
sloop::s3_dispatch(print(mtcars))
methods("print")
sloop::s3_methods_generic("print")
Useful Packages for Exploration
| Package | Purpose |
|---|
sloop | Understand S3/S4 OOP |
pryr | Inspect R internals |
lobstr | Visualize data structures |
pkgapi | Extract package API |
Anti-patterns
- Installing packages without user approval - always ask before running
install.packages()
- Using
library() just to access help (use ?pkg::fun instead)
- Ignoring vignettes (they often have the best explanations)
- Not checking examples in help pages
- Searching the web before checking built-in docs
References