get_docstring {toscutil} | R Documentation |
Get docstring for a Function
Description
The roxygen2 package makes it possible to write documentation for R functions directly above the corresponding function. This function can be used to retrieve the full documentation string (docstring).
Usage
get_docstring(content, func, collapse = TRUE, template = DOCSTRING_TEMPLATE)
Arguments
content |
R code as string. |
func |
Name of function to get docstring for. |
collapse |
Whether to collapse all docstring into a single string. |
template |
String to return in case no docstring could be found. |
Value
A character vector of length 1 containing either the docstring or the empty string (in case no documentation could be detected).
Examples
uri <- system.file("testfiles/funcs.R", package = "toscutil")
content <- readLines(uri)
func <- "f2"
get_docstring(content, func)
get_docstring(content, func, collapse = TRUE)
[Package toscutil version 2.8.0 Index]