knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of rresutils is to support teaching of R using Quarto/R Markdown.
You can install the released version of rresutils from GitHub with:
devtools::install_github("rressler/rresutils")
or
remotes::install_github("rressler/rresutils")
The package has two sets of similar functions. These are based on ideas and code samples in section 17.5 of the R Markdown Cookbook
quarto_render()
Functionsrres_render_solutions()
params:solutions
where the values are either true
or false
. These values turn code chunk options such as eval
, echo
, or include
on and off respectively.Use the console to run rresutils::rres_render_solutions("my_path/file.qmd")
.
The default file extension is "html" but you can change to another extension with argument fext = "pdf"
.
rres_render_solutions_date()
This function operates the same as rres_render_solutions()
but it appends the Sys.Date()
value at the end of the file name.
Use the console to run rresutils::rres_knit_solutions_date("my_path/file.qmd")
.
rmarkdown::render()
Functionsrres_knit_solutions()
params:solutions
where the values are either TRUE
or FALSE
. These values turn code chunk options such as eval
or echo
on and off respectively.Enter the following into the YAML header and then knit. It will use the first output type in your YAML be it PDF or HTML. The file with solutions will have the "_solutions" in the file name.
knit: rresutils::rres_knit_solutions
rres_knit_solutions_date()
This function operates the same as rres_knit_solutions()
but it appends the Sys.Date()
value at the end of the file name.
Enter the following into the YAML header and then knit. It will use the first output type in your YAML be it PDF or HTML. The file with the solutions will have "_solutions" in the file name. Both files will have the current date added to the file name.
knit: rresutils::rres_knit_solutions_date
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.