#| label: DoNotModify #| include: false ### Utilities. Do not modify. # Installation of packages if necessary install_packages <- function(packages) { install_package <- function(package) { if (!package %in% installed.packages()[, 1]) { install.packages(package, repos = "https://cran.rstudio.com/") } } invisible(sapply(packages, install_package)) } # Basic packages install_packages(c("bookdown", "formatR", "kableExtra", "ragg")) # Chunk font size hook: allows size='small' or any valid Latex font size in chunk options def.chunk.hook <- knitr::knit_hooks$get("chunk") knitr::knit_hooks$set(chunk = function(x, options) { x <- def.chunk.hook(x, options) ifelse( options$size != "normalsize", paste0("\n \\", options$size,"\n\n", x, "\n\n \\normalsize"), x ) })
#| label: Options #| include: false ### Customized options for this document # Add necessary packages here packages <- c("tidyverse") # Install them install_packages(packages) # knitr options knitr::opts_chunk$set( cache = FALSE, # Cache chunk results include = TRUE, # Show/Hide chunks echo = FALSE, # Show/Hide code warning = FALSE, # Show/Hide warnings message = FALSE, # Show/Hide messages # Figure alignment and size fig.align = 'center', out.width = '80%', # Graphic devices (ragg_png is better than standard png) dev = c("ragg_png", "pdf"), # Code chunk format tidy = TRUE, tidy.opts = list(blank = FALSE, width.cutoff = 50), size = "scriptsize", knitr.graphics.auto_pdf = TRUE ) options(width = 50) # ggplot style library("tidyverse") theme_set(theme_bw()) theme_update( panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA) ) knitr::opts_chunk$set(dev.args = list(bg = "transparent")) # Tibbles: 5 lines, fit to slide width options(tibble.print_min = 5, tibble.width = 50) # Random seed set.seed(973)
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
This template has the same features as others in the memoiR package except for
multi-language support (no lang
item in the header).
See the code of the following slides for some specific code of slides.
Incremental bullets start with > -
instead of -
:
- Bullet 1
- A reference: @Xie2016.
- Bullet 3
R code chunks are displayed as follows:
#| label: cars #| echo: true head(cars)
#| label: pressure plot(pressure)
\begincols \begincol{.48\textwidth}
This slide has two columns.
In Beamer, each column in between \begincol
and \endcol
.
In HTML, the {.columns-2}
option is added to the slide title and <p class="forceBreak"></p>
allows forcing column break.
\endcol \begincol{.48\textwidth}
#| label: pressure2 #| out-width: 90% plot(pressure)
\endcol \endcols
See R Markdown: The Definitive Guide for full documentation about HTML slides.
Note:
{.flexbox .vcenter}
to center the HTML slide with plot.out.width='90%'
to reduce the size of the plot in the Two Column Layout slide.Keep the code below to have a slide for references, allow two-column slides in ioslides (but not in Slidy) and allow scrolling oversized slides.
r if (!knitr:::is_latex_output()) '## References {.smaller}'
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.