Extracts specified portions of R help files for use in Sweave or R-markdown documents.
helpExtract(Function, section = "Usage", type = "m_code", ...)
Function | The function that you are extracting the help file from. |
---|---|
section | The section you want to extract. Defaults to |
type | The type of character vector you want returned. Defaults to
|
... | Other arguments passed to |
A character vector to be used in a Sweave or R-markdown document.
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))}
Ananda Mahto
#> ```r #> var(x, y = NULL, na.rm = FALSE, use) #> #> cov(x, y = NULL, use = "everything", #> method = c("pearson", "kendall", "spearman")) #> #> cor(x, y = NULL, use = "everything", #> method = c("pearson", "kendall", "spearman")) #> #> cov2cor(V) #> ```#> var(x, y = NULL, na.rm = FALSE, use) #> #> cov(x, y = NULL, use = "everything", #> method = c("pearson", "kendall", "spearman")) #> #> cor(x, y = NULL, use = "everything", #> method = c("pearson", "kendall", "spearman")) #> #> cov2cor(V)#> ‘var’, ‘cov’ and ‘cor’ compute the variance of ‘x’ and the covariance #> or correlation of ‘x’ and ‘y’ if these are vectors. If ‘x’ and ‘y’ are #> matrices then the covariances (or correlations) between the columns of #> ‘x’ and the columns of ‘y’ are computed. #> #> ‘cov2cor’ scales a covariance matrix into the corresponding correlation #> matrix _efficiently_.