Skip to content

Instantly share code, notes, and snippets.

@elifiner
Created August 27, 2015 11:00
Show Gist options
  • Save elifiner/938d53f0289f2234e2f3 to your computer and use it in GitHub Desktop.
Save elifiner/938d53f0289f2234e2f3 to your computer and use it in GitHub Desktop.
get_help_section_text <- function (func, section) {
funcq <- substitute(func)
if (!is.character(func)) {
func <- deparse(funcq)
}
Rd <- utils:::.getHelpFile(help(func))
data <- tools:::.Rd_get_section(Rd, section)
result <- character()
if (length(data)) {
result <- tools:::.Rd_get_text(data)
result <- result[nzchar(result)]
}
paste(result, collapse = "\n")
}
get_help_section_text(cat, "title")
get_help_section_text(cat, "description")
get_help_section_text(cat, "usage")
get_help_section_text(cat, "examples")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment