
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.
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'.
# 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: