The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
When analyzing data sets in R, it is often convenient to wrap the analysis within a quarto document for reporting purposes: containing all the analysis components within a single easy-to-navigate HTML document is generally a kindness for the reader. One consequence of this is that sometimes you find yourself wanting to write code within an R code chunk that will generate parts of the quarto document for you. For instance, when iterating over many analyses within a single R chunk, you might want to have that chunk generate the quarto section headers, tabsets and so on. This is possible because the knitr engine (which evaluates the R code chunks) allows you to generate “asis” output that will later be captured by the quarto parser; if such output is formatted to look like correct quarto syntax, it will be captured and translated to the appropriate HTML.
The purpose of the quartose package is to provide some helper functions to make this task a little easier. The reason for writing it is that while it is conceptually straightforward to generate quarto syntax within R, there are some practical issues in juggling knitr, quarto, and R all at once if you want the resulting document to look clean. The goal in writing the quartose package is to handle some of those niceties, making it a little easier to work programmatically within quarto documents.
You can install the development version of quartose from GitHub with:
# install.packages("pak")
::pak("djnavarro/quartose") pak
The core idea is illustrated with this example:
library(quartose)
# define a quarto tabset
<- quarto_tabset(
tabs content = list(tab1 = 1:5, tab2 = "hello"),
title = "My tabs",
level = 2
)
# base::print() outputs a simple summary
print(tabs)
#> <quarto_tabset>
#> • content: <list>
#> • title: My tabs
#> • names: tab1 tab2
#> • level: 2
# knitr::knit_print() outputs quarto syntax
::knit_print(tabs)
knitr#>
#>
#> ## My tabs
#>
#>
#>
#>
#> ::: {.panel-tabset}
#>
#>
#>
#>
#> ### tab1
#>
#>
#> <pre>
#> [1] 1 2 3 4 5
#> </pre>
#>
#>
#> ### tab2
#>
#>
#> <pre>
#> [1] "hello"
#> </pre>
#>
#>
#> :::
#>
#>
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.