Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
When documenting R functions with roxygen2, use the `[]` syntax to create cross-references to other documentation:
Sign in to like and favorite skills
When documenting R functions with roxygen2, use the
[] syntax to create cross-references to other documentation:
[function_name()] - Link to a function in the same package[pkg::function_name()] - Link to a function in another package[topic] - Link to a topic/object in the same package[pkg::topic] - Link to a topic/object in another package[NULL] - Creates a cross-reference to the NULL object documentation[data.frame] - Creates a cross-reference to data.frame documentation[testthat::expect_snapshot_file()] - Links to testthat's expect_snapshot_file functionAlways use the cross-reference syntax for return values that are documented objects:
#' @returns [NULL] (from [testthat::expect_snapshot_file()])
NOT:
#' @returns Invisible `NULL` (from ...)
The
[NULL] syntax creates a proper link to the NULL documentation, while backticks just format it as code without creating a link.
This package uses roxygen2 with markdown enabled (see
DESCRIPTION file: Roxygen: list(markdown = TRUE)).
This means you can use:
[] for cross-references` for inline code