object_code_documentation: Code Documentation

View source: R/utils.R

object_code_documentationR Documentation

Code Documentation

Description

Using package codedoc capabilities, extract documentation blocks from your source code (using codedoc::extract_keyed_comment_blocks) to be added to the R documentation for that object.

Usage

object_code_documentation(
  text_file_paths,
  regex,
  head = "@details",
  tail = character(0L),
  extract_arg_list = list(),
  grepl_arg_list = list(perl = TRUE)
)

Arguments

text_file_paths

⁠[character]⁠ (mandatory, no default)

passed to codedoc::extract_keyed_comment_blocks

regex

⁠[character]⁠ (mandatory, no default)

regular expression used to identify which comment blocks to retain; see codedoc::extract_keyed_comment_blocks; the regex is applied to retain only those results that pertain to the keys that match the regex

head

⁠[character]⁠ (mandatory, default "@details")

these lines will be at the head of the output vector

tail

⁠[character]⁠ (mandatory, default "@details")

these lines will be at the tail of the output vector

extract_arg_list

⁠[list]⁠ (optional, default list())

additional args passed to codedoc::extract_keyed_comment_blocks, other than text_file_paths

grepl_arg_list

⁠[list]⁠ (optional, default list(perl = TRUE))

additional args passed to base::grepl, other than pattern and x.

Details

so you have a roxygen block for your object you want to document. to include programmatically generated lines into the doc, use the ⁠@eval⁠ tag like so:

⁠#' @eval nordcancore::object_code_documentation("R/my_script.R", "my_obj")⁠


CancerRegistryOfNorway/nordcancore documentation built on April 29, 2024, 4:40 p.m.