knitr::opts_chunk$set( collapse = FALSE, comment = "#>", fig.path = "README-" )
knitr::include_graphics("https://raw.githubusercontent.com/GegznaV/knitrContainer/master/docs/logo.png")
knitrContainer
knitrContainer
knitrContainer
is an R package. Its purpose is
to collect objects (especially those generated in loops) and print them in knitr
-- R Markdown reports.
Some objects such as pander
tables and plotly
plots, are not printed from
inside loop in a knitr
report file in a regular way.knitrContainer
solves
this problem by providing fuctions to get these objects printed and included
in HTML
files.
knitrContainer
?An object used by knitrContainer
can be any object, that is
includable in R list an that is printable, such as :
Install development version from GitHub:
if (!require(devtools)) install.packages("devtools") library(devtools) install_github("GegznaV/knitrContainer")
knitrContainer
?Only 4 actions (in short: "CASP") should be done for basic use of knitrContainer
package:
knitrContainer()
);add_as_*
family functions, e.g. add_as_is()
);results
to results='asis'
in a chunk of R code in knitr
report file;print_all()
in the chunk which has option results='asis'
.library(knitrContainer)
# Create container <- knitrContainer() # Collect container <- add_as_text(container, "Text to be added.") # Print print_all(container)
Example how to add objects using the operator %<>%
from package
magrittr
:
container %<>% add_as_text("Text added using `%<>%` operator.")
It is the same as:
container <- add_as_text(container, "Text added using `<-` operator.")
Type the following code in R to learn more about operator %<>%
:
?`%<>%`
vignette("v1_examples", package = "knitrContainer")
Meaning of symbols in function descriptions:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.