powered by
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).
get_docstring(content, func, collapse = TRUE, template = DOCSTRING_TEMPLATE)
A character vector of length 1 containing either the docstring or the empty string (in case no documentation could be detected).
R code as string.
Name of function to get docstring for.
Whether to collapse all docstring into a single string.
String to return in case no docstring could be found.
uri <- system.file("testfiles/funcs.R", package = "toscutil") content <- readLines(uri) func <- "f2" get_docstring(content, func) get_docstring(content, func, collapse = TRUE)
Run the code above in your browser using DataLab