#' Print help information on console
#' @import tools
#' @export
print_help_console <- function(
topic,
format = c("text", "html", "latex", "Rd"),
lines = NULL,
before = NULL,
after = NULL) {
format <- match.arg(format)
if (!is.character(topic)) topic <- deparse(substitute(topic))
helpfile <- utils:::.getHelpFile(help(topic))
hs <- capture.output(switch(format,
text = tools:::Rd2txt(helpfile),
html = tools:::Rd2HTML(helpfile),
latex = tools:::Rd2latex(helpfile),
Rd = tools:::prepare_Rd(helpfile)
))
hs <- gsub("_\b", "", hs)
if (!is.null(lines)) hs <- hs[lines]
hs <- c(before, hs, after)
cat(hs, sep = "\n")
invisible(hs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.