get_docstring | R Documentation |
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)
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. |
A character vector of length 1 containing either the docstring or the empty string (in case no documentation could be detected).
uri <- system.file("testfiles/funcs.R", package = "toscutil")
content <- readLines(uri)
func <- "f2"
get_docstring(content, func)
get_docstring(content, func, collapse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.