The YAML header will look like this:
---
title: "Analysis of SARS-CoV-2 concentration in wastewater"
author: "Julia Wrobel"
date: "2024-07-24"
output:
html_document:
code_folding: hide
toc: true
toc_float: true
params:
state: "ga"
download_raw_data: FALSE
hitheme: tomorrow
highlighter: highlight.js
---
The default state is Georgia.
To be able to filter by state, we will need to add a line of code to
the file 02_data_cleaning.R
so that it can access the value
of param$state
. Add the following line of code to the
beginning of the 02_data_cleaning.R
file.
state = params$state
We add the param download_raw_data
with the following
code to allow the user to toggle whether or not to download the raw
data.
if(params$download_raw_data){
source(here("source", "01_data_download.R"))
}else if(!file.exists(here::here("data", "raw.Rdata"))){
source(here("source", "01_data_download.R"))
}
source(here("source", "02_data_cleaning.R"))
Finally, we can run the parameterized report by knitting the document, or by running the following code in the R console:
rmarkdown::render(here::here("analysis","final_report.Rmd"), params = list(
state = "nj",
download_raw_data = TRUE
))
A copy of the entire 20240722_sismid_repro
folder with
parameterized final report is available for download here.