Here is a slightly better solution than @SteffenMoritz that avoid the creation of files by using a text connection that writes into a variable string s
:
display_help <- function(subject, pkg = NULL) {
tc <- textConnection("s", "w", local = TRUE)
tools:::Rd2HTML(utils:::.getHelpFile(help(subject, (pkg))), out = tc)
knitr::asis_output(htmltools::htmlPreserve(s))
}
You may then use this function in code cells:
```{r, echo = F}
display_help("gold")
The `pkg` parameter may be necessary for help to find the function, just pass the package name as a string:
display_help("geom_bar", pkg = "ggplot2")
Here is a version of the same \`display_help()\` function for Jupyter book:
display_help <- function(subject, pkg = NULL) { tc <- textConnection("s", "w", local = TRUE) tools:::Rd2HTML(utils:::.getHelpFile(help(subject, (pkg))), out = tc) IRdisplay::display_html(htmltools::htmlPreserve(s)) }