Extracts specified portions of R help files for use in Sweave or R-markdown documents.
Details
The type
argument accepts:
"m_code"
: For use with markdown documents in instances where highlighted code is expected, for example the "Usage" section."m_text"
: For use with markdown documents in instances where regular text is expected, for example the "Description" section."s_code"
: For use with Sweave documents in instances where highlighted code is expected, for example the "Usage" section."s_text"
: For use with Sweave documents in instances where regular text is expected, for example the "Description" section.
To insert a chunk into a markdown document, use something like:
```{r, echo=FALSE, results='asis'}
cat(helpExtract(cor), sep =
"\n")
```
To insert a chunk into a Sweave document, use something like:
\Sexpr{knit_child(textConnection(helpExtract(cor, type = "s_code")),
options = list(tidy = FALSE, eval = FALSE))}
Author
Ananda Mahto (https://github.com/mrdwab/SOfun)