RMarkdown parameters & presentations {#rmarkdownparams}

les <- 9
knitr::opts_chunk$set(echo = TRUE, class.source="Rchunk", class.output="Rout")

{ width=30%}

knitr::opts_chunk$set(
  echo = TRUE,
  warning = FALSE,
  message = FALSE,
  error = FALSE

  )
## Packages
library(utils)
library(tidyverse)
library(tools)
library(glue)
library(readxl) 
library(httr) 
library(zoo)
#library(blscrapeR)

Lesson Contents

Note that class time this week will be mostly spend on the practice job interviews.

Introduction

As we saw previously, RMarkdown is R's answer to doing reproducible research. In this lesson we take the next step in customization of RMardown reports. We will see that RMarkdown can be used for a number of semi- and fully automated reporting work flows.

This is a much shorter lesson than the previous ones, as we will have the portfolio presentations today. The lesson consists mainly of a number of exercises.

RMarkdown parameterization

By now you must have a clear idea on the possibilities of writing a reproducible static analysis report in RMarkdown. It is time to make it a bit more flexible and robust. Most of the time an analysis will depend on several parameters that you might want to vary for an analysis. We can think of the following things (this list is not exclusive):

##### Exercise `r les`{-} Discuss the possibilities with your class mates and come up with at least 2 more uses for parameterized RMDs.
##### Exercise `r les`{-} **Ocean Data** To learn how to build a parameterized RMarkdown, go over [this tutorial](https://rmarkdown.rstudio.com/lesson-6.html). The Rmd file of this tutorial can be found in the course repo: `./Rmd/ocean_floor.Rmd` Go over the following steps to complete the exercise 1. Knit the Rmd as is and see what happens. For now, don’t try to knit it from within your bookdown project folder, open it in a different session and folder. You will be prompted to install some packages (*marmap*, *mapproj*). 1. It will not knit and give an error. Google your error and solve the problem. 1. Now that it works, try adjusting the parameter 'data' according the available datasets in the `{marmap}` (the command `data(package = "marmap")`, will give you the available setting for the `data` parameter) 1. Knit using the render() function as shown in the link but use `rmarkdown::render()`. 1. Paste the rmarkdown::render() command in a separate script (so not in the ocean_floor.Rmd) and build a forloop to generate 4 different reports automatically. You can use `vcdExtra::datasets("marmap")` to get all the available dataset names in a dataframe.

Portfolio assignment {-}

Maak nu opdracht 8 van de portfolio-opdrachten.

Resources


CC BY-NC-SA 4.0 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Unless it was borrowed (there will be a link), in which case, please use their license.



DataScienceILC/tlsc-dsfb26v-20_workflows documentation built on July 4, 2025, 5:49 a.m.