├── products ├── poster │ ├── readme.md │ ├── media │ │ ├── logo.png │ │ ├── resulttable2.rds │ │ ├── summarytable.rds │ │ ├── height-weight.png │ │ └── height-weight-stratified.png │ ├── _extensions │ │ └── quarto-ext │ │ │ └── poster │ │ │ ├── _extension.yml │ │ │ ├── typst-show.typ │ │ │ └── typst-template.typ │ └── poster.qmd ├── presentation │ ├── media │ │ ├── height-weight.png │ │ ├── resulttable2.rds │ │ ├── summarytable.rds │ │ └── my-presentation-styling.css │ ├── readme.md │ └── presentation.qmd ├── manuscript │ ├── readme.md │ ├── supplement │ │ └── Supplementary-Material.qmd │ └── Manuscript.qmd └── README.md ├── assets ├── placeholder.png ├── antigen-recognition.png ├── references │ ├── 2020-mckay-ofid.pdf │ └── 2020-mckay-prsb.pdf ├── README.md ├── dataanalysis-references.bib ├── american-journal-of-epidemiology.csl └── vancouver-author-date.csl ├── data ├── raw-data │ ├── exampledata.xlsx │ └── README.md ├── processed-data │ ├── processeddata.rds │ └── readme.md └── README.md ├── results ├── tables │ ├── resulttable1.rds │ ├── resulttable2.rds │ ├── summarytable.rds │ └── README.md ├── figures │ ├── height-weight.png │ ├── README.md │ ├── height-distribution.png │ ├── weight-distribution.png │ └── height-weight-stratified.png ├── output │ └── README.md ├── README.md └── large-files │ └── README.md ├── code ├── analysis-code │ ├── README.md │ └── statistical-analysis.R ├── processing-code │ ├── processingfile-v2_files │ │ ├── figure-html │ │ │ └── cleandata1-1.png │ │ └── libs │ │ │ ├── bootstrap │ │ │ └── bootstrap-icons.woff │ │ │ ├── quarto-html │ │ │ ├── tippy.css │ │ │ ├── quarto-syntax-highlighting.css │ │ │ ├── anchor.min.js │ │ │ └── popper.min.js │ │ │ └── clipboard │ │ │ └── clipboard.min.js │ ├── processingfile-v1_files │ │ ├── figure-html │ │ │ └── unnamed-chunk-5-1.png │ │ └── libs │ │ │ ├── bootstrap │ │ │ └── bootstrap-icons.woff │ │ │ ├── quarto-html │ │ │ ├── tippy.css │ │ │ ├── quarto-syntax-highlighting.css │ │ │ ├── anchor.min.js │ │ │ ├── popper.min.js │ │ │ └── tippy.umd.min.js │ │ │ └── clipboard │ │ │ └── clipboard.min.js │ ├── readme.md │ ├── processingfile-v2.qmd │ ├── processingfile-v1.qmd │ └── processingcode.R ├── eda-code │ ├── readme.md │ ├── edacode.R │ ├── eda-v2.qmd │ └── eda.qmd └── README.md ├── data-analysis-template.Rproj ├── .gitignore └── README.md /products/poster/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains an example poster using Quarto and typst. 2 | 3 | -------------------------------------------------------------------------------- /assets/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/assets/placeholder.png -------------------------------------------------------------------------------- /assets/antigen-recognition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/assets/antigen-recognition.png -------------------------------------------------------------------------------- /data/raw-data/exampledata.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/data/raw-data/exampledata.xlsx -------------------------------------------------------------------------------- /products/poster/media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/poster/media/logo.png -------------------------------------------------------------------------------- /results/tables/resulttable1.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/tables/resulttable1.rds -------------------------------------------------------------------------------- /results/tables/resulttable2.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/tables/resulttable2.rds -------------------------------------------------------------------------------- /results/tables/summarytable.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/tables/summarytable.rds -------------------------------------------------------------------------------- /results/figures/height-weight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/figures/height-weight.png -------------------------------------------------------------------------------- /results/figures/README.md: -------------------------------------------------------------------------------- 1 | # figures 2 | 3 | Folder for all figures. 4 | 5 | You can create further sub-folders if that makes sense. 6 | -------------------------------------------------------------------------------- /assets/references/2020-mckay-ofid.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/assets/references/2020-mckay-ofid.pdf -------------------------------------------------------------------------------- /assets/references/2020-mckay-prsb.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/assets/references/2020-mckay-prsb.pdf -------------------------------------------------------------------------------- /data/processed-data/processeddata.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/data/processed-data/processeddata.rds -------------------------------------------------------------------------------- /products/poster/media/resulttable2.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/poster/media/resulttable2.rds -------------------------------------------------------------------------------- /products/poster/media/summarytable.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/poster/media/summarytable.rds -------------------------------------------------------------------------------- /products/poster/media/height-weight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/poster/media/height-weight.png -------------------------------------------------------------------------------- /results/figures/height-distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/figures/height-distribution.png -------------------------------------------------------------------------------- /results/figures/weight-distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/figures/weight-distribution.png -------------------------------------------------------------------------------- /products/presentation/media/height-weight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/presentation/media/height-weight.png -------------------------------------------------------------------------------- /products/presentation/media/resulttable2.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/presentation/media/resulttable2.rds -------------------------------------------------------------------------------- /products/presentation/media/summarytable.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/presentation/media/summarytable.rds -------------------------------------------------------------------------------- /results/figures/height-weight-stratified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/results/figures/height-weight-stratified.png -------------------------------------------------------------------------------- /products/poster/media/height-weight-stratified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/products/poster/media/height-weight-stratified.png -------------------------------------------------------------------------------- /results/tables/README.md: -------------------------------------------------------------------------------- 1 | # tables 2 | 3 | Folder for all tables (if you use R, often stored as Rds files) 4 | 5 | You can create further sub-folders if that makes sense. 6 | -------------------------------------------------------------------------------- /code/analysis-code/README.md: -------------------------------------------------------------------------------- 1 | # analysis-code 2 | 3 | This folder contains an R script with a bit of a statistical analysis. This is only implemented as an R script, no Quarto version. 4 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2_files/figure-html/cleandata1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/code/processing-code/processingfile-v2_files/figure-html/cleandata1-1.png -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/code/processing-code/processingfile-v1_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /results/output/README.md: -------------------------------------------------------------------------------- 1 | # output 2 | 3 | Folder for output files from models or other analyses. These need to be 4 | further processed into figures or tables for presentation. 5 | 6 | There's currently no example present. -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/bootstrap/bootstrap-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/code/processing-code/processingfile-v1_files/libs/bootstrap/bootstrap-icons.woff -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2_files/libs/bootstrap/bootstrap-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahgroup/data-analysis-template/HEAD/code/processing-code/processingfile-v2_files/libs/bootstrap/bootstrap-icons.woff -------------------------------------------------------------------------------- /data-analysis-template.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /products/poster/_extensions/quarto-ext/poster/_extension.yml: -------------------------------------------------------------------------------- 1 | title: Poster 2 | author: Carlos Scheidegger 3 | version: 1.0.0 4 | quarto-required: ">=1.4.415" 5 | contributes: 6 | formats: 7 | typst: 8 | template-partials: 9 | - typst-template.typ 10 | - typst-show.typ 11 | 12 | -------------------------------------------------------------------------------- /code/eda-code/readme.md: -------------------------------------------------------------------------------- 1 | # eda-code 2 | 3 | This folder contains code to do a simple exploratory data analysis (EDA) on the processed/cleaned data. 4 | The code produces a few tables and figures, which are saved in the appropriate `results` sub-folder. 5 | 6 | It's the same code done 3 times. For explanations on the 3 different ways, see the readme file in the `processing-code` folder. 7 | 8 | -------------------------------------------------------------------------------- /data/processed-data/readme.md: -------------------------------------------------------------------------------- 1 | # processed-data 2 | 3 | This folder contains data that has been processed and cleaned by code. 4 | 5 | Any files located in here are based on the raw data and can be re-created running the various processing/cleaning code scripts in the `code` folder. 6 | 7 | You could add a codebook here, but you could also just provide enough comments in the code that produces the content in this folder for users to understand what is saved in this location. -------------------------------------------------------------------------------- /results/README.md: -------------------------------------------------------------------------------- 1 | # results 2 | 3 | This folder and subfolders contain results produced by the code, such as figures and tables, and other files. 4 | 5 | A special folder for large files exists. This folder is set in .gitignore to be ignored when pushing/pulling. See the readme in that folder for details. 6 | 7 | Structure the folders inside `results` such that they make sense for your specific analysis. Provide enough documentation that someone can understand what you are doing and what goes where. `readme.md` files inside each folder are a good idea. 8 | -------------------------------------------------------------------------------- /products/presentation/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains an example of a slide presentation using Quarto and the `revealjs` output format. 2 | 3 | The general suggestion is to place figures/tables/Rds files etc. that are used in the presentation in the `media` folder. 4 | 5 | You could also pull it from the main project `results` folder, but the advantage of copying them into `media` is that you have everything related to your presentation in one place, and if contentigures inside `results` continues to be changed/updated, you can ensure you have the version you used in your presentation by copying it into `media`. 6 | 7 | -------------------------------------------------------------------------------- /products/manuscript/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains a template for an academic manuscript. The content of the template is structured as a report for a class, but you can easily replace it with whatever structure you need. 2 | 3 | Most manuscripts these days have supplementary material, place those into the `supplement` folder. (You can have the supplement inside the `manuscript` folder or next to it, whatever is better for your setup). 4 | 5 | Figures/tables/etc. should be pulled from their respective locations by code, as shown in the example. 6 | 7 | Based on what most journals want, it is generally best to have the main manuscript render to a Word file, and the supplement to a pdf. Deviations might be necessary, based on specific circumstances. 8 | -------------------------------------------------------------------------------- /data/raw-data/README.md: -------------------------------------------------------------------------------- 1 | #raw-data 2 | 3 | This folder should contain all raw data. As needed add sub-folders. 4 | 5 | Currently, as an example, it contains a simple made-up data-set in an Excel file. 6 | 7 | The dataset contains the variables `Height`, `Weight` and `Gender` of a few imaginary individuals. 8 | 9 | The dataset purposefully contains some faulty entries that need to be cleaned. 10 | 11 | Generally, any dataset should contain some meta-data explaining what each variable in the dataset is. (This is often called a **Codebook**.) For this simple example, the codebook is given as a second sheet in the Excel file. 12 | 13 | This raw data-set should generally not be edited by hand. It should instead be loaded and processed/cleaned using code. 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # Example code in package build process 9 | *-Ex.R 10 | 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | 14 | # Output files from R CMD check 15 | /*.Rcheck/ 16 | 17 | # RStudio files 18 | .Rproj.user/ 19 | 20 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 21 | .httr-oauth 22 | 23 | # knitr and R markdown default cache directories 24 | /*_cache/ 25 | /cache/ 26 | 27 | # Temporary files created by R markdown 28 | *.utf8.md 29 | *.knit.md 30 | 31 | # MacOS specific .DS_Store files 32 | .DS_Store 33 | 34 | # Folder for large files 35 | results/large-files/* 36 | 37 | # But we want to commit the folder and the readme! 38 | !results/large-files/readme.md 39 | -------------------------------------------------------------------------------- /results/large-files/README.md: -------------------------------------------------------------------------------- 1 | # large-files 2 | 3 | This is where you should store the results of computations that produce 4 | large files, such as posterior samples from Bayesian models. 5 | 6 | Folder for any large files that are too big to be tracked with GitHub. 7 | That's generally anything above around 20MB. 8 | 9 | This folder is set in `.gitignore` to be ignored when pushing/pulling. (The folder itself and the readme will be synced, but all other files will be ignored.) 10 | 11 | This allows large files to be part of the project. If you want to collaborate with someone or work on multiple computers, you need to manually share/transfer everything in this folder, e.g. by Dropbox/OneDrive/etc. 12 | 13 | If you use a cloud service, you should add the link to the storage location and instructions for obtaining access below. 14 | 15 | Link to large files: LINK-GOES-HERE 16 | Instructions for obtaining large files: email/discord message/etc. INFO HERE. 17 | -------------------------------------------------------------------------------- /code/README.md: -------------------------------------------------------------------------------- 1 | # code 2 | 3 | This folder and sub-folders should contain all your code. This can be R or Quarto files (or files for other programming languages). 4 | 5 | Place your files in the appropriate sub-folders. You can structure the folders as appropriate. 6 | 7 | You can either have fewer large scripts, or multiple scripts that do only specific actions. Those can be R or Quarto files (or some other language/format). In either case, document the scripts and what goes on in them so well that someone else (including future you) can easily figure out what is happening. 8 | 9 | The scripts should load the appropriate data (e.g. raw or processed), perform actions, and save results (e.g. processed data, figures, computed values) in the appropriate folders. Document somewhere what inputs each script takes and where output is placed. 10 | 11 | If scripts need to be run in a specific order, document this. Either as comments in the script, or in a separate text file such as this readme file. Ideally of course in both locations. 12 | 13 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # Assets 2 | 3 | This folder should contain all static content from outside sources which is 4 | neither code nor generated by code. This includes, but is not limited to, 5 | schematics generated from biorender, other images taken from outside sources, 6 | `csl` files, `bib` files, pdf files of references, etc. 7 | 8 | As needed, this can be organized further. For instance one could have separate folders for references or figures (again, not figures generated by code, only manually created figures, e.g. conceptual/schematic drawings). 9 | 10 | The `csl` files are referenced in your Quarto docs and influence the style of the references both in the text and at the reference listing at the end. 11 | Journals require specific formats. While writing, I recommend you use either the more explicit (Author, year) format (as e.g. implemented in `vancouver-author-date`) or tha more concise [#] format that just shows numbers (as e.g. implemented in `american-journal-of-epidemiology.csl`). You can download many more reference style files from here: 12 | https://www.zotero.org/styles 13 | 14 | -------------------------------------------------------------------------------- /code/processing-code/readme.md: -------------------------------------------------------------------------------- 1 | # processing-code 2 | 3 | This folder contains code for processing data. 4 | 5 | It currently contains 3 example files, showing the same processing steps done using slightly different setup with R and Quarto. 6 | 7 | * First, there is an R script that you can run which does all the cleaning. 8 | * Second, there is a Quarto file which contains exactly the same code as the R script, with some comments. Everything lives inside the Quarto file. 9 | * Third, my current favorite, is a Quarto file with an approach where the code is pulled in from the R script and run. 10 | 11 | The last version has the advantage of having code in one place for easy writing/debugging, and then being able to pull the code into the Quarto file for a nice combination of text/commentary and code. 12 | 13 | Each way of doing this is a reasonable approach, pick whichever one you prefer or makes the most sense for your setup. You can also mix and match. For instance for an EDA task, it might make sense to produce a Quarto file. Then I would use the 2nd or 3rd approach. If you do a main analysis, then you might just want to have an R script that does the data analysis and saves the results to a file, for later use/processing. You might not need or want a quarto file for that. 14 | 15 | Whichever approach you choose, add ample documentation/commentary so you and others can easily understand what's going on and what is done. -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/quarto-html/tippy.css: -------------------------------------------------------------------------------- 1 | .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2_files/libs/quarto-html/tippy.css: -------------------------------------------------------------------------------- 1 | .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} -------------------------------------------------------------------------------- /code/eda-code/edacode.R: -------------------------------------------------------------------------------- 1 | ## ---- packages -------- 2 | #load needed packages. make sure they are installed. 3 | library(here) #for data loading/saving 4 | library(dplyr) 5 | library(skimr) 6 | library(ggplot2) 7 | 8 | ## ---- loaddata -------- 9 | #Path to data. Note the use of the here() package and not absolute paths 10 | data_location <- here::here("data","processed-data","processeddata.rds") 11 | #load data 12 | mydata <- readRDS(data_location) 13 | 14 | ## ---- table1 -------- 15 | summary_df = skimr::skim(mydata) 16 | print(summary_df) 17 | # save to file 18 | summarytable_file = here("results","tables", "summarytable.rds") 19 | saveRDS(summary_df, file = summarytable_file) 20 | 21 | ## ---- height -------- 22 | p1 <- mydata %>% ggplot(aes(x=Height)) + geom_histogram() 23 | plot(p1) 24 | figure_file = here("results", "figures", "height-distribution.png") 25 | ggsave(filename = figure_file, plot=p1) 26 | 27 | ## ---- weight -------- 28 | p2 <- mydata %>% ggplot(aes(x=Weight)) + geom_histogram() 29 | plot(p2) 30 | figure_file = here("results", "figures", "weight-distribution.png") 31 | ggsave(filename = figure_file, plot=p2) 32 | 33 | ## ---- fitfig1 -------- 34 | p3 <- mydata %>% ggplot(aes(x=Height, y=Weight)) + geom_point() + geom_smooth(method='lm') 35 | plot(p3) 36 | figure_file = here("results","figures", "height-weight.png") 37 | 38 | ## ---- fitfig2 -------- 39 | p4 <- mydata %>% ggplot(aes(x=Height, y=Weight, color = Gender)) + geom_point() + geom_smooth(method='lm') 40 | plot(p4) 41 | figure_file = here("results","figures", "height-weight-stratified.png") 42 | ggsave(filename = figure_file, plot=p4) 43 | 44 | 45 | -------------------------------------------------------------------------------- /products/README.md: -------------------------------------------------------------------------------- 1 | # products 2 | 3 | The folders inside this folder should contain all the products of your project. 4 | 5 | For a classical academic project, this will be a peer-reviewed manuscript. Often, you will also give presentations and/or make posters based on your work. 6 | 7 | The `manuscript` folder contains a template for an academic manuscript. The content of the template is structured as a report for a class, but you can easily replace it with whatever structure you need. 8 | 9 | Most manuscripts these days have supplementary material, place those into the `supplement` folder. (You can have the supplement inside the `manuscript` folder or next to it, whatever is better for your setup). 10 | 11 | Often, you might make/give a presentation on your work and make slides for that. An example is the `presentation` folder. 12 | 13 | Similarly, it is common to make posters to present at conferences. An example using Quarto is in the `poster` folder. 14 | 15 | Often you need a library of references in bibtex format, as well as a CSL style file that determines reference formatting. Those files might be used by several of the products. They should be placed into the `assets` folder, or for presentations and posters, separately into their respective `media` folders. 16 | 17 | You can add further folders. For instance, if you have multiple presentations or posters, you might want to create subfolders for each. 18 | Or you could have a `blog-post` folder if you plan to write a blog-post. It's up to you how to structure/organize, as long as it is somewhat logical and you document it. ideally, put a readme file in each folder to orient others/your future self on what is going on. 19 | 20 | -------------------------------------------------------------------------------- /code/analysis-code/statistical-analysis.R: -------------------------------------------------------------------------------- 1 | ############################### 2 | # analysis script 3 | # 4 | #this script loads the processed, cleaned data, does a simple analysis 5 | #and saves the results to the results folder 6 | 7 | #load needed packages. make sure they are installed. 8 | library(ggplot2) #for plotting 9 | library(broom) #for cleaning up output from lm() 10 | library(here) #for data loading/saving 11 | 12 | #path to data 13 | #note the use of the here() package and not absolute paths 14 | data_location <- here::here("data","processed-data","processeddata.rds") 15 | 16 | #load data. 17 | mydata <- readRDS(data_location) 18 | 19 | 20 | ###################################### 21 | #Data fitting/statistical analysis 22 | ###################################### 23 | 24 | ############################ 25 | #### First model fit 26 | # fit linear model using height as outcome, weight as predictor 27 | 28 | lmfit1 <- lm(Height ~ Weight, mydata) 29 | 30 | # place results from fit into a data frame with the tidy function 31 | lmtable1 <- broom::tidy(lmfit1) 32 | 33 | #look at fit results 34 | print(lmtable1) 35 | 36 | # save fit results table 37 | table_file1 = here("results", "tables", "resulttable1.rds") 38 | saveRDS(lmtable1, file = table_file1) 39 | 40 | ############################ 41 | #### Second model fit 42 | # fit linear model using height as outcome, weight and gender as predictor 43 | 44 | lmfit2 <- lm(Height ~ Weight + Gender, mydata) 45 | 46 | # place results from fit into a data frame with the tidy function 47 | lmtable2 <- broom::tidy(lmfit2) 48 | 49 | #look at fit results 50 | print(lmtable2) 51 | 52 | # save fit results table 53 | table_file2 = here("results", "tables", "resulttable2.rds") 54 | saveRDS(lmtable2, file = table_file2) 55 | 56 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | # data 2 | 3 | The folders inside this folder should contain all data at various stages. 4 | 5 | This data is being loaded/manipulated/changed/saved with code from the `code` folders. 6 | 7 | You should place the raw data in the `raw-data` folder and not edit it. Ever! 8 | 9 | Ideally, load the raw data into R and do all changes there with code, so everything is automatically reproducible and documented. 10 | 11 | Sometimes, you need to edit the files in the format you got. For instance, Excel files are sometimes so poorly formatted that it's close to impossible to read them into R, or the persons you got the data from used color to code some information, which of course won't import into R. In those cases, you might have to make modifications in a software other than R. If you need to make edits in whatever format you got the data (e.g. Excel), make a copy and place those copies in a separate folder, AND ONLY EDIT THOSE COPIES. Also, write down somewhere the edits you made. 12 | 13 | Add as many sub-folders as suitable. If you only have a single processing step, one sub-folder for processed data is enough. If you have multiple stages of cleaning and processing, additional sub-folders might be useful. Adjust based on the complexity of your project. 14 | 15 | I suggest you save your processed and cleaned data as RDS or RDA/Rdata files. This preserves coding like factors, characters, numeric, etc. If you save as CSV, that information would get lost. 16 | However, CSV is better for sharing with others since it's plain text. If you do CSV, you might want to write down somewhere what each variable is. 17 | 18 | See here for some suggestions on how to store your processed data: 19 | 20 | http://www.sthda.com/english/wiki/saving-data-into-r-data-format-rds-and-rdata 21 | -------------------------------------------------------------------------------- /products/presentation/presentation.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Example Quarto slides 3 | subtitle: "with some thoughts on how to set up things" 4 | date: 2025-01-01 5 | author: "NAME" 6 | format: 7 | revealjs: 8 | theme: default 9 | css: "./media/my-presentation-styling.css" 10 | transition: none 11 | incremental: false 12 | cap-location: bottom 13 | self-contained: true 14 | slide-number: true 15 | show-slide-number: all 16 | auto-stretch: true 17 | smaller: false 18 | bibliography: ../../assets/dataanalysis-references.bib 19 | csl: ../../assets/american-journal-of-epidemiology.csl 20 | --- 21 | 22 | ## Overview 23 | 24 | - A few simple slides using the [`revealjs` (html) format](https://quarto.org/docs/presentations/revealjs/). 25 | - For other formats (e.g. Powerpoint, or Beamer/pdf), see [here](https://quarto.org/docs/guide/). 26 | 27 | 28 | ## Figures and tables 29 | 30 | The suggestion is to place figures/tables/Rds files etc. in the `media` folder. 31 | 32 | You could also pull it from the `results` folder, but the advantage of copying them into `media` is that you have everything related to your presentation in one place, and if contentigures inside `results` continues to be changed/updated, you can ensure you have the version you used in your presentation by copying it into `media`. 33 | 34 | 35 | 36 | ## Example slide 37 | 38 | This shows the summary table. It is pulled in from an Rds file and rendered as R chunk with the `kable` package. In general, we suggest more powerful/flexible table packages, such as `gt` or `flextable`, but for this example, `kable` is good enough. 39 | 40 | Note that we could have loaded the data with `here()`, but if we ever want to copy this presentation to another folder outside the current project, you would have to adjust the path. 41 | 42 | ```{r} 43 | #| label: tbl-summarytable 44 | #| tbl-cap: "Data summary table." 45 | #| echo: FALSE 46 | resulttable=readRDS("./media/summarytable.rds") 47 | knitr::kable(resulttable) 48 | ``` 49 | 50 | ## Example slide 51 | 52 | This shows a figure created by the analysis script. It is inserted using Quarto/Markdown syntax (not knitr code, but that would be possible too). 53 | 54 | ![](./media/height-weight.png){fig-align="center" width="420"} 55 | 56 | ## Example slide 57 | 58 | This shows the model fitting results as table. 59 | 60 | ```{r} 61 | #| label: tbl-resulttable2 62 | #| tbl-cap: "Linear model fit table." 63 | #| echo: FALSE 64 | resulttable2 = readRDS("./media/resulttable2.rds") 65 | knitr::kable(resulttable2) 66 | ``` 67 | 68 | ## Example slide with reference 69 | 70 | This paper [@leek2015] discusses types of analyses. 71 | 72 | ## Further Resources 73 | 74 | * [Quarto Presentation Documentation](https://quarto.org/docs/presentations/) 75 | * [Slidecraft 101](https://emilhvitfeldt.com/project/slidecraft-101/) is a nice blog post showing some more advanced things one can do with Quarto slides. 76 | 77 | ## References 78 | -------------------------------------------------------------------------------- /products/presentation/media/my-presentation-styling.css: -------------------------------------------------------------------------------- 1 | /* Handel slide template 2 | * Last Modified: 2020-07-06 3 | -------------------------------------------------------------------------------- */ 4 | 5 | 6 | 7 | #mytextbox 8 | { 9 | border: 10px solid #cfd7e0; 10 | color: black; 11 | font-weight: normal; 12 | } 13 | 14 | #bigfont 15 | { 16 | font-size: 300%; 17 | font-weight: bold; 18 | } 19 | 20 | #myimage 21 | { 22 | max-height: 10%; 23 | } 24 | 25 | #verysmall 26 | { 27 | font-size: 50%; 28 | } 29 | 30 | .verysmall 31 | { 32 | font-size: 50%; 33 | } 34 | 35 | 36 | .small { font-size: 70% } 37 | 38 | 39 | .smallfont pre { 40 | font-size: 50%; 41 | } 42 | 43 | 44 | 45 | /* Remove slide numbering if using xaringan */ 46 | .remark-slide-number { 47 | display: none; 48 | } 49 | 50 | 51 | html { 52 | /* Box-model */ 53 | margin: 0; 54 | padding: 0; 55 | border: 0; 56 | 57 | /* Visual */ 58 | background-color: #fff; /* white */ 59 | color: black; /* dark grey */ 60 | } 61 | 62 | 63 | /* Image 64 | ---------------*/ 65 | img { 66 | max-width: 100%; 67 | max-height: 80%; 68 | padding: 3px; 69 | 70 | } 71 | .image { 72 | display: inline-block; 73 | margin-left: 0; 74 | margin-right: 0; 75 | padding: 0; 76 | text-align: center; 77 | 78 | /* Visual */ 79 | border-radius: 1px; 80 | border: 0 solid #ccc; /* light grey */ 81 | } 82 | .figure { 83 | margin-left: 0; 84 | margin-right: 0; 85 | padding: 0; 86 | text-align: center; 87 | 88 | /* Visual */ 89 | border-radius: 1px; 90 | border: 0 solid #ccc; /* light grey */ 91 | } 92 | .caption { 93 | padding: 0; 94 | margin: auto; 95 | margin-bottom: 3px; 96 | } 97 | 98 | 99 | /* Change color of regular text and h2 100 | also change spacing between heading and main text 101 | -------------------- */ 102 | slides > slide { 103 | color: black; 104 | } 105 | 106 | h2 { 107 | color: #123c66; /* dark blue */ 108 | margin-bottom: -30px; 109 | } 110 | 111 | 112 | /* Turn off page count in footer */ 113 | slides > slide:not(.nobackground):after { 114 | content: ''; 115 | } 116 | 117 | 118 | /* Keep text off left side of screen 119 | -------------------- */ 120 | p { 121 | margin-right: 0; 122 | } 123 | 124 | 125 | /* My additions 126 | -------------------- */ 127 | 128 | #classname 129 | { 130 | color: #123c66; 131 | font-weight: bold; 132 | text-align: center; 133 | font-size: 120%; 134 | } 135 | 136 | #classauthor 137 | { 138 | color: black; 139 | font-weight: normal; 140 | text-align: center; 141 | 142 | } 143 | 144 | #mylicense 145 | { 146 | text-align: center; 147 | font-size: 70%; 148 | 149 | } 150 | 151 | iframe { 152 | display: block; 153 | margin-left: auto; 154 | margin-right: auto; 155 | } 156 | 157 | 158 | /* Change vertical spacing for lists */ 159 | li:not(:last-child) { 160 | margin-bottom: 5px; 161 | } 162 | 163 | 164 | -------------------------------------------------------------------------------- /products/poster/_extensions/quarto-ext/poster/typst-show.typ: -------------------------------------------------------------------------------- 1 | // Typst custom formats typically consist of a 'typst-template.typ' (which is 2 | // the source code for a typst template) and a 'typst-show.typ' which calls the 3 | // template's function (forwarding Pandoc metadata values as required) 4 | // 5 | // This is an example 'typst-show.typ' file (based on the default template 6 | // that ships with Quarto). It calls the typst function named 'article' which 7 | // is defined in the 'typst-template.typ' file. 8 | // 9 | // If you are creating or packaging a custom typst template you will likely 10 | // want to replace this file and 'typst-template.typ' entirely. You can find 11 | // documentation on creating typst templates here and some examples here: 12 | // - https://typst.app/docs/tutorial/making-a-template/ 13 | // - https://github.com/typst/templates 14 | 15 | #show: doc => poster( 16 | $if(title)$ title: [$title$], $endif$ 17 | // TODO: use Quarto's normalized metadata. 18 | $if(poster-authors)$ authors: [$poster-authors$], $endif$ 19 | $if(departments)$ departments: [$departments$], $endif$ 20 | $if(size)$ size: "$size$", $endif$ 21 | 22 | // Institution logo. 23 | $if(institution-logo)$ univ_logo: "$institution-logo$", $endif$ 24 | 25 | // Footer text. 26 | // For instance, Name of Conference, Date, Location. 27 | // or Course Name, Date, Instructor. 28 | $if(footer-text)$ footer_text: [$footer-text$], $endif$ 29 | 30 | // Any URL, like a link to the conference website. 31 | $if(footer-url)$ footer_url: [$footer-url$], $endif$ 32 | 33 | // Emails of the authors. 34 | $if(footer-emails)$ footer_email_ids: [$footer-emails$], $endif$ 35 | 36 | // Color of the footer. 37 | $if(footer-color)$ footer_color: "$footer-color$", $endif$ 38 | 39 | // DEFAULTS 40 | // ======== 41 | // For 3-column posters, these are generally good defaults. 42 | // Tested on 36in x 24in, 48in x 36in, and 36in x 48in posters. 43 | // For 2-column posters, you may need to tweak these values. 44 | // See ./examples/example_2_column_18_24.typ for an example. 45 | 46 | // Any keywords or index terms that you want to highlight at the beginning. 47 | $if(keywords)$ keywords: ($for(keywords)$"$it$"$sep$, $endfor$), $endif$ 48 | 49 | // Number of columns in the poster. 50 | $if(num-columns)$ num_columns: $num-columns$, $endif$ 51 | 52 | // University logo's scale (in %). 53 | $if(univ-logo-scale)$ univ_logo_scale: $univ-logo-scale$, $endif$ 54 | 55 | // University logo's column size (in in). 56 | $if(univ-logo-column-size)$ univ_logo_column_size: $univ-logo-column-size$, $endif$ 57 | 58 | // Title and authors' column size (in in). 59 | $if(title-column-size)$ title_column_size: $title-column-size$, $endif$ 60 | 61 | // Poster title's font size (in pt). 62 | $if(title-font-size)$ title_font_size: $title-font-size$, $endif$ 63 | 64 | // Authors' font size (in pt). 65 | $if(authors-font-size)$ authors_font_size: $authors-font-size$, $endif$ 66 | 67 | // Footer's URL and email font size (in pt). 68 | $if(footer-url-font-size)$ footer_url_font_size: $footer-url-font-size$, $endif$ 69 | 70 | // Footer's text font size (in pt). 71 | $if(footer-text-font-size)$ footer_text_font_size: [$footer-text-font-size$], $endif$ 72 | 73 | doc, 74 | ) 75 | -------------------------------------------------------------------------------- /code/eda-code/eda-v2.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "An example exploratory analysis script with code pulled in" 3 | date: "2024-02-07" 4 | output: html_document 5 | --- 6 | 7 | 8 | 9 | This Quarto file loads the cleaned data and does some exploring. 10 | 11 | This is essentially the same as the other `exploratory_analysis` Quarto file, but now the code is not inside this file. Instead, it is pulled in from the R script `exploratorycode.R` using the code chunk labels. 12 | 13 | Also note that while here I split cleaning and exploring, this is iterative. You saw that as part of the processing, we already had to explore the data somewhat to understand how to clean it. In general, as you explore, you'll find things that need cleaning. As you clean, you can explore more. Therefore, at times it might make more sense to combine the cleaning and exploring code parts into a single R or Quarto file. Or split things in any other logical way. 14 | 15 | As part of the exploratory analysis, you should produce plots or tables or other summary quantities for the most interesting/important quantities in your data. Depending on the total number of variables in your dataset, explore all or some of the others. Figures produced here might be histograms or density plots, correlation plots, etc. Tables might summarize your data. 16 | 17 | Start by exploring one variable at a time. Then continue by creating plots or tables of the outcome(s) of interest and the predictor/exposure/input variables you are most interested in. If your dataset is small, you can do that for all variables. 18 | 19 | Plots produced here can be scatterplots, boxplots, violinplots, etc. Tables can be simple 2x2 tables or larger ones. 20 | 21 | 22 | 23 | # Setup 24 | Load the chunk. 25 | 26 | ```{r, include=FALSE, cache=FALSE} 27 | knitr::read_chunk('edacode.R') 28 | ``` 29 | 30 | Load the packages. 31 | ```{r,packages, echo=FALSE,message=FALSE} 32 | ``` 33 | 34 | 35 | Load the data. 36 | 37 | ```{r,loaddata} 38 | ``` 39 | 40 | 41 | 42 | 43 | 44 | # Data exploration through tables 45 | 46 | Showing a bit of code to produce and save a summary table. 47 | 48 | 49 | ```{r,table1} 50 | ``` 51 | 52 | We are saving the results to the `results` folder. Depending on how many tables/figures you have, it might make sense to have separate folders for each. And/or you could have separate folders for exploratory tables/figures and for final tables/figures. Just choose a setup that makes sense for your project and works for you, and provide enough documentation that someone can understand what you are doing. 53 | 54 | 55 | # Data exploration through figures 56 | 57 | Histogram plots for the continuous outcomes. 58 | 59 | Height first. 60 | 61 | ```{r,height} 62 | ``` 63 | 64 | Now weights. 65 | 66 | ```{r,weight} 67 | ``` 68 | 69 | Now height as function of weight. 70 | 71 | ```{r,fitfig1} 72 | ``` 73 | 74 | Once more height as function of weight, stratified by gender. Note that there is so little data, it's a bit silly. But we'll plot it anyway. 75 | 76 | ```{r,fitfig2} 77 | ``` 78 | 79 | 80 | 81 | # Notes 82 | 83 | For your own explorations, tables and figures can be "quick and dirty". As long as you can see what's going on, there is no need to polish them. That's in contrast to figures you'll produce for your final products (paper, report, presentation, website, etc.). Those should look as nice, polished and easy to understand as possible. 84 | 85 | 86 | -------------------------------------------------------------------------------- /products/poster/poster.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: This is an academic poster with typst and quarto! 3 | format: 4 | poster-typst: 5 | size: "36x24" 6 | poster-authors: "A. Smith, B. Jones, C. Brown" 7 | departments: "Department of Something" 8 | institution-logo: "./media/logo.png" 9 | footer-text: "Some Conference" 10 | footer-url: "" 11 | footer-emails: "abc@example.com" 12 | footer-color: "ebcfb2" 13 | keywords: ["Poster", "Typst", "Quarto"] 14 | --- 15 | 16 | 17 | # Background 18 | 19 | * This is a poster created with Quarto using the Typst system. 20 | * It is based on this template and extension: https://github.com/quarto-ext/typst-templates/tree/main/poster 21 | * Typst can't run code, therefore any tables one want to include need to be generated and saved as figures outside of this document. 22 | * There is unfortunately currently no robust way to make posters with Quarto yet. If you have suggestions for better Quarto-based alternatives, please let us know! 23 | 24 | # Abstract 25 | 26 | Abstract of your project. 27 | 28 | # Methods 29 | 30 | One can do equations. 31 | 32 | $$ 33 | \sum_(k=1)^n k = \frac{(n(n+1))}{2} = \frac{(n^2 + n)}{2} 34 | $$ 35 | 36 | 37 | # Result 38 | 39 | This shows a figure created by the analysis script. It is inserted using Quarto/Markdown syntax (not knitr code, but that would be possible too). 40 | 41 | ![Figure caption.](./media/height-weight.png){fig-align="center" width="420"} 42 | 43 | And here is a table. 44 | 45 | ```{r} 46 | #| label: tbl-summarytable 47 | #| tbl-cap: "Data summary table." 48 | #| echo: FALSE 49 | resulttable=readRDS("./media/summarytable.rds") 50 | knitr::kable(resulttable) 51 | ``` 52 | 53 | 54 | Here is another figure, now using a code chunk. 55 | 56 | 57 | ```{r} 58 | #| label: fig-2 59 | #| echo: FALSE 60 | #| fig-cap: "Caption for this figure." 61 | knitr::include_graphics("./media/height-weight-stratified.png") 62 | ``` 63 | 64 | ## Aonther subsection with results 65 | 66 | This shows the model fitting results as table. 67 | 68 | ```{r} 69 | #| label: tbl-resulttable2 70 | #| tbl-cap: "Linear model fit table." 71 | #| echo: FALSE 72 | resulttable2 = readRDS("./media/resulttable2.rds") 73 | knitr::kable(resulttable2) 74 | ``` 75 | 76 | 77 | 78 | 79 | # Discussion 80 | 81 | We did some analysis. 82 | 83 | 84 | 85 | # Acknowledgements 86 |
87 | This project is partially supported by NIH contract 75N93019C00060. 88 |
89 | 90 | 91 | # Lorem ipsum dolor. 92 | 93 | ::: {.block fill="luma(230)" inset="8pt" radius="4pt"} 94 | 95 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere malum nobis opinemur. Quod idem licet transferre in voluptatem, ut postea variari voluptas distinguique possit, augeri amplifi- carique non possit. At etiam Athenis, ut e patre audiebam facete et urbane Stoicos irridente, statua est in quo a nobis philosophia defensa et. 96 | 97 | - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do. 98 | - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do. 99 | - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do. 100 | 101 | ::: 102 | 103 | 104 | -------------------------------------------------------------------------------- /products/manuscript/supplement/Supplementary-Material.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Supplement to Example Manuscript Template for a Data Analysis Project" 3 | format: 4 | pdf: 5 | toc: false 6 | number-sections: true 7 | highlight-style: github 8 | bibliography: ../../assets/dataanalysis-references.bib 9 | csl: ../../assets/american-journal-of-epidemiology.csl 10 | --- 11 | 12 | 13 | ```{r, echo=FALSE, message=FALSE} 14 | # load a few R packages 15 | library(here) 16 | library(knitr) 17 | ``` 18 | 19 | 20 | 21 | 22 | This shows some materials that could go into a supplementary file. Often you want/need references here too. You can use the same reference bib file for this and the main text (as done here) or have separate bib files. 23 | 24 | For illustrative purposes, I'm doing the supplement as pdf. For this to work, you need a (La)TeX system installed. It's easy. Just follow [these steps](https://quarto.org/docs/output-formats/pdf-basics.html). 25 | 26 | Of course you would choose the format based on needs. 27 | 28 | I'm also using a different style for the references here. (vancouver vs apa in the main manuscript). Usually one would have the formatting of the references the same in those two documents, but I want to illustrate how easy it is to switch reference formatting styles, you just need to get the right CSL file and specify it in the YAML header. We could also have a seperate reference bibtext (`.bib`) file, but here we are using the same. 29 | 30 | 31 | {{< pagebreak >}} 32 | 33 | 34 | 35 | 36 | # Overview 37 | 38 | A quick overview of what readers can find in the supplement. 39 | 40 | 41 | # Code and file information 42 | 43 | Explain here what each code/file is and does, and in which order (if any) users need to run thing to reproduce everything. 44 | Essentially, give a full set of instructions to re-generate everything. 45 | 46 | 47 | {{< pagebreak >}} 48 | 49 | 50 | # Additional Method Details 51 | 52 | Often, the main manuscript only allows for an overview description of the methods. Use the supplement to describe all your methods, models and approaches in a lot of detail. Reference specific parts of your code as needed. 53 | 54 | {{< pagebreak >}} 55 | 56 | 57 | # Additional results 58 | 59 | Show additional results here. Those can be some useful exploratory/descriptive figures or tables, or results from additional analyses that didn't make it into the main text. 60 | 61 | 62 | ## Example additional result 63 | 64 | 65 | @tbl-resulttable1 shows an additional table summarizing a model fit. 66 | 67 | ```{r} 68 | #| label: tbl-resulttable1 69 | #| tbl-cap: "Another fit table." 70 | #| echo: FALSE 71 | resulttable1 = readRDS(here("results","tables","resulttable1.rds")) 72 | knitr::kable(resulttable1) 73 | ``` 74 | 75 | 76 | 77 | @fig-result2 shows a scatterplot figure produced by one of the R scripts. 78 | 79 | 80 | ```{r} 81 | #| label: fig-result2 82 | #| fig-cap: "Height and weight." 83 | #| echo: FALSE 84 | knitr::include_graphics(here("results","figures","height-weight.png")) 85 | ``` 86 | 87 | 88 | {{< pagebreak >}} 89 | 90 | 91 | # Discussion 92 | 93 | Any additional discussion regarding the supplementary material/findings. 94 | 95 | These papers [@mckay2020; @mckay2020a] are good examples of papers published using a fully reproducible setup similar to the one shown in this template. 96 | 97 | {{< pagebreak >}} 98 | 99 | 100 | # References 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "An example cleaning script with code pulled in" 3 | author: "Andreas Handel" 4 | date: "2024-02-07" 5 | output: html_document 6 | --- 7 | 8 | 9 | # Processing script with code pulled in 10 | 11 | This is essentially the same as the other Quarto file, but now the code is not inside this file. Instead, it is pulled in from the R script using the code chunk labels. 12 | 13 | 14 | 15 | 16 | # Setup 17 | 18 | This needs to run to load the R script so we can include the code chunks below. 19 | 20 | Note that you can pull in more than one R script if you want. 21 | 22 | ```{r, include=FALSE, cache=FALSE} 23 | knitr::read_chunk('processingcode.R') 24 | ``` 25 | 26 | 27 | 28 | 29 | Load needed packages. Instead of having R commands here, this just pulls in the code from the R script we loaded above and labelled. 30 | 31 | 32 | ```{r, packages, message = FALSE, warning = FALSE} 33 | ``` 34 | 35 | 36 | # Data loading 37 | 38 | Note that for functions that come from specific packages (instead of base R), I often specify both package and function like so: 39 | package::function() that's not required one could just call the function specifying the package makes it clearer where the function "lives", 40 | but it adds typing. You can do it either way. 41 | 42 | ```{r, loaddata} 43 | ``` 44 | 45 | 46 | # Explore data 47 | 48 | Several ways of looking at the data 49 | 50 | ```{r, exploredata} 51 | ``` 52 | 53 | 54 | # Cleaning 55 | 56 | By inspecting the data as done above, we find some problems that need addressing: 57 | 58 | First, there is an entry for height which says "sixty" instead of a number. 59 | Does that mean it should be a numeric 60? It somehow doesn't make sense since the weight is 60kg, which can't happen for a 60cm person (a baby). 60 | Since we don't know how to fix this, we might decide to remove the person. This "sixty" entry also turned all Height entries into characters instead of numeric. That conversion to character also means that our summary function isn't very meaningful. So let's fix that first. 61 | 62 | ```{r, cleandata1} 63 | ``` 64 | 65 | Now we see that there is one person with a height of 6. That could be a typo, or someone mistakenly entered their height in feet. Since we unfortunately don't know, we might need to remove this person, which we'll do here. 66 | 67 | ```{r, cleandata2} 68 | ``` 69 | 70 | Height values seem ok now. 71 | 72 | Now let's look at the `Weight` variable. There is a person with weight of 7000, which is impossible, and one person with missing weight. 73 | To be able to analyze the data, we'll remove those individuals as well. 74 | 75 | Note that removing anyone who had "faulty" or missing data is one approach. It's often not the best. Based on your question and your analysis approach, you might want to do cleaning differently (e.g. keep individuals with some missing information). 76 | 77 | 78 | ```{r, cleandata3} 79 | ``` 80 | 81 | Now checking the `Gender` variable. 82 | 83 | ```{r, cleandata4} 84 | ``` 85 | 86 | ```{r, cleandata5} 87 | ``` 88 | 89 | 90 | # Save data 91 | 92 | All done, data is clean now. Time to save. 93 | Let's assign at the end to some final variable, this makes it easier to add further cleaning steps above. 94 | 95 | Finally, we save the clean data as RDS file. I suggest you save your processed and cleaned data as RDS or RDA/Rdata files. 96 | This preserves coding like factors, characters, numeric, etc. If you save as CSV, that information would get lost. 97 | However, CSV is better for sharing with others since it's plain text. If you do CSV, you might want to write down somewhere what each variable is. 98 | 99 | See here for some suggestions on how to store your processed data: 100 | http://www.sthda.com/english/wiki/saving-data-into-r-data-format-rds-and-rdata 101 | 102 | ```{r, savedata} 103 | ``` 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/quarto-html/quarto-syntax-highlighting.css: -------------------------------------------------------------------------------- 1 | /* quarto syntax highlight colors */ 2 | :root { 3 | --quarto-hl-ot-color: #003B4F; 4 | --quarto-hl-at-color: #657422; 5 | --quarto-hl-ss-color: #20794D; 6 | --quarto-hl-an-color: #5E5E5E; 7 | --quarto-hl-fu-color: #4758AB; 8 | --quarto-hl-st-color: #20794D; 9 | --quarto-hl-cf-color: #003B4F; 10 | --quarto-hl-op-color: #5E5E5E; 11 | --quarto-hl-er-color: #AD0000; 12 | --quarto-hl-bn-color: #AD0000; 13 | --quarto-hl-al-color: #AD0000; 14 | --quarto-hl-va-color: #111111; 15 | --quarto-hl-bu-color: inherit; 16 | --quarto-hl-ex-color: inherit; 17 | --quarto-hl-pp-color: #AD0000; 18 | --quarto-hl-in-color: #5E5E5E; 19 | --quarto-hl-vs-color: #20794D; 20 | --quarto-hl-wa-color: #5E5E5E; 21 | --quarto-hl-do-color: #5E5E5E; 22 | --quarto-hl-im-color: #00769E; 23 | --quarto-hl-ch-color: #20794D; 24 | --quarto-hl-dt-color: #AD0000; 25 | --quarto-hl-fl-color: #AD0000; 26 | --quarto-hl-co-color: #5E5E5E; 27 | --quarto-hl-cv-color: #5E5E5E; 28 | --quarto-hl-cn-color: #8f5902; 29 | --quarto-hl-sc-color: #5E5E5E; 30 | --quarto-hl-dv-color: #AD0000; 31 | --quarto-hl-kw-color: #003B4F; 32 | } 33 | 34 | /* other quarto variables */ 35 | :root { 36 | --quarto-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 37 | } 38 | 39 | pre > code.sourceCode > span { 40 | color: #003B4F; 41 | } 42 | 43 | code span { 44 | color: #003B4F; 45 | } 46 | 47 | code.sourceCode > span { 48 | color: #003B4F; 49 | } 50 | 51 | div.sourceCode, 52 | div.sourceCode pre.sourceCode { 53 | color: #003B4F; 54 | } 55 | 56 | code span.ot { 57 | color: #003B4F; 58 | font-style: inherit; 59 | } 60 | 61 | code span.at { 62 | color: #657422; 63 | font-style: inherit; 64 | } 65 | 66 | code span.ss { 67 | color: #20794D; 68 | font-style: inherit; 69 | } 70 | 71 | code span.an { 72 | color: #5E5E5E; 73 | font-style: inherit; 74 | } 75 | 76 | code span.fu { 77 | color: #4758AB; 78 | font-style: inherit; 79 | } 80 | 81 | code span.st { 82 | color: #20794D; 83 | font-style: inherit; 84 | } 85 | 86 | code span.cf { 87 | color: #003B4F; 88 | font-style: inherit; 89 | } 90 | 91 | code span.op { 92 | color: #5E5E5E; 93 | font-style: inherit; 94 | } 95 | 96 | code span.er { 97 | color: #AD0000; 98 | font-style: inherit; 99 | } 100 | 101 | code span.bn { 102 | color: #AD0000; 103 | font-style: inherit; 104 | } 105 | 106 | code span.al { 107 | color: #AD0000; 108 | font-style: inherit; 109 | } 110 | 111 | code span.va { 112 | color: #111111; 113 | font-style: inherit; 114 | } 115 | 116 | code span.bu { 117 | font-style: inherit; 118 | } 119 | 120 | code span.ex { 121 | font-style: inherit; 122 | } 123 | 124 | code span.pp { 125 | color: #AD0000; 126 | font-style: inherit; 127 | } 128 | 129 | code span.in { 130 | color: #5E5E5E; 131 | font-style: inherit; 132 | } 133 | 134 | code span.vs { 135 | color: #20794D; 136 | font-style: inherit; 137 | } 138 | 139 | code span.wa { 140 | color: #5E5E5E; 141 | font-style: italic; 142 | } 143 | 144 | code span.do { 145 | color: #5E5E5E; 146 | font-style: italic; 147 | } 148 | 149 | code span.im { 150 | color: #00769E; 151 | font-style: inherit; 152 | } 153 | 154 | code span.ch { 155 | color: #20794D; 156 | font-style: inherit; 157 | } 158 | 159 | code span.dt { 160 | color: #AD0000; 161 | font-style: inherit; 162 | } 163 | 164 | code span.fl { 165 | color: #AD0000; 166 | font-style: inherit; 167 | } 168 | 169 | code span.co { 170 | color: #5E5E5E; 171 | font-style: inherit; 172 | } 173 | 174 | code span.cv { 175 | color: #5E5E5E; 176 | font-style: italic; 177 | } 178 | 179 | code span.cn { 180 | color: #8f5902; 181 | font-style: inherit; 182 | } 183 | 184 | code span.sc { 185 | color: #5E5E5E; 186 | font-style: inherit; 187 | } 188 | 189 | code span.dv { 190 | color: #AD0000; 191 | font-style: inherit; 192 | } 193 | 194 | code span.kw { 195 | color: #003B4F; 196 | font-style: inherit; 197 | } 198 | 199 | .prevent-inlining { 200 | content: " code.sourceCode > span { 40 | color: #003B4F; 41 | } 42 | 43 | code span { 44 | color: #003B4F; 45 | } 46 | 47 | code.sourceCode > span { 48 | color: #003B4F; 49 | } 50 | 51 | div.sourceCode, 52 | div.sourceCode pre.sourceCode { 53 | color: #003B4F; 54 | } 55 | 56 | code span.ot { 57 | color: #003B4F; 58 | font-style: inherit; 59 | } 60 | 61 | code span.at { 62 | color: #657422; 63 | font-style: inherit; 64 | } 65 | 66 | code span.ss { 67 | color: #20794D; 68 | font-style: inherit; 69 | } 70 | 71 | code span.an { 72 | color: #5E5E5E; 73 | font-style: inherit; 74 | } 75 | 76 | code span.fu { 77 | color: #4758AB; 78 | font-style: inherit; 79 | } 80 | 81 | code span.st { 82 | color: #20794D; 83 | font-style: inherit; 84 | } 85 | 86 | code span.cf { 87 | color: #003B4F; 88 | font-style: inherit; 89 | } 90 | 91 | code span.op { 92 | color: #5E5E5E; 93 | font-style: inherit; 94 | } 95 | 96 | code span.er { 97 | color: #AD0000; 98 | font-style: inherit; 99 | } 100 | 101 | code span.bn { 102 | color: #AD0000; 103 | font-style: inherit; 104 | } 105 | 106 | code span.al { 107 | color: #AD0000; 108 | font-style: inherit; 109 | } 110 | 111 | code span.va { 112 | color: #111111; 113 | font-style: inherit; 114 | } 115 | 116 | code span.bu { 117 | font-style: inherit; 118 | } 119 | 120 | code span.ex { 121 | font-style: inherit; 122 | } 123 | 124 | code span.pp { 125 | color: #AD0000; 126 | font-style: inherit; 127 | } 128 | 129 | code span.in { 130 | color: #5E5E5E; 131 | font-style: inherit; 132 | } 133 | 134 | code span.vs { 135 | color: #20794D; 136 | font-style: inherit; 137 | } 138 | 139 | code span.wa { 140 | color: #5E5E5E; 141 | font-style: italic; 142 | } 143 | 144 | code span.do { 145 | color: #5E5E5E; 146 | font-style: italic; 147 | } 148 | 149 | code span.im { 150 | color: #00769E; 151 | font-style: inherit; 152 | } 153 | 154 | code span.ch { 155 | color: #20794D; 156 | font-style: inherit; 157 | } 158 | 159 | code span.dt { 160 | color: #AD0000; 161 | font-style: inherit; 162 | } 163 | 164 | code span.fl { 165 | color: #AD0000; 166 | font-style: inherit; 167 | } 168 | 169 | code span.co { 170 | color: #5E5E5E; 171 | font-style: inherit; 172 | } 173 | 174 | code span.cv { 175 | color: #5E5E5E; 176 | font-style: italic; 177 | } 178 | 179 | code span.cn { 180 | color: #8f5902; 181 | font-style: inherit; 182 | } 183 | 184 | code span.sc { 185 | color: #5E5E5E; 186 | font-style: inherit; 187 | } 188 | 189 | code span.dv { 190 | color: #AD0000; 191 | font-style: inherit; 192 | } 193 | 194 | code span.kw { 195 | color: #003B4F; 196 | font-style: inherit; 197 | } 198 | 199 | .prevent-inlining { 200 | content: "% ggplot(aes(x=Height)) + geom_histogram() 75 | plot(p1) 76 | figure_file = here("results", "figures","height-distribution.png") 77 | ggsave(filename = figure_file, plot=p1) 78 | ``` 79 | 80 | Now weights. 81 | 82 | ```{r} 83 | p2 <- mydata %>% ggplot(aes(x=Weight)) + geom_histogram() 84 | plot(p2) 85 | figure_file = here("results", "figures","weight-distribution.png") 86 | ggsave(filename = figure_file, plot=p2) 87 | ``` 88 | 89 | Now height as function of weight. 90 | 91 | ```{r} 92 | p3 <- mydata %>% ggplot(aes(x=Height, y=Weight)) + geom_point() + geom_smooth(method='lm') 93 | plot(p3) 94 | figure_file = here("results", "figures", "height-weight.png") 95 | ggsave(filename = figure_file, plot=p3) 96 | ``` 97 | 98 | Once more height as function of weight, stratified by gender. Note that there is so little data, it's a bit silly. But we'll plot it anyway. 99 | 100 | ```{r} 101 | p4 <- mydata %>% ggplot(aes(x=Height, y=Weight, color = Gender)) + geom_point() + geom_smooth(method='lm') 102 | plot(p4) 103 | figure_file = here("results", "figures", "height-weight-stratified.png") 104 | ggsave(filename = figure_file, plot=p4) 105 | ``` 106 | 107 | 108 | 109 | # Notes 110 | 111 | For your own explorations, tables and figures can be "quick and dirty". As long as you can see what's going on, there is no need to polish them. That's in contrast to figures you'll produce for your final products (paper, report, presentation, website, etc.). Those should look as nice, polished and easy to understand as possible. 112 | 113 | 114 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "An example cleaning script" 3 | author: "Andreas Handel" 4 | date: "2024-02-07" 5 | output: html_document 6 | --- 7 | 8 | 9 | # Processing script 10 | 11 | This contains the same code and comments/information as `processingcode.R`. 12 | 13 | This just shows it as Quarto file, to give you an idea how to do it in a setup that combines code and text in a single file. 14 | 15 | See the other Quarto file for my currently preferred approach of pulling code from the R script into the Quarto file. 16 | 17 | 18 | # Setup 19 | 20 | Load needed packages. make sure they are installed. 21 | 22 | ```{r} 23 | library(readxl) #for loading Excel files 24 | library(dplyr) #for data processing/cleaning 25 | library(tidyr) #for data processing/cleaning 26 | library(skimr) #for nice visualization of data 27 | library(here) #to set paths 28 | ``` 29 | 30 | 31 | # Data loading 32 | 33 | Note that for functions that come from specific packages (instead of base R), I often specify both package and function like so: 34 | package::function() that's not required one could just call the function specifying the package makes it clearer where the function "lives", 35 | but it adds typing. You can do it either way. 36 | 37 | ```{r} 38 | # path to data 39 | # note the use of the here() package and not absolute paths 40 | data_location <- here::here("data","raw-data","exampledata.xlsx") 41 | rawdata <- readxl::read_excel(data_location) 42 | ``` 43 | 44 | 45 | # Check data 46 | 47 | First we can look at the codebook 48 | 49 | ```{r} 50 | codebook <- readxl::read_excel(data_location, sheet ="Codebook") 51 | print(codebook) 52 | ``` 53 | 54 | 55 | Several ways of looking at the data 56 | 57 | ```{r} 58 | dplyr::glimpse(rawdata) 59 | summary(rawdata) 60 | head(rawdata) 61 | skimr::skim(rawdata) 62 | ``` 63 | 64 | 65 | 66 | # Cleaning 67 | 68 | By inspecting the data as done above, we find some problems that need addressing: 69 | 70 | First, there is an entry for height which says "sixty" instead of a number. 71 | Does that mean it should be a numeric 60? It somehow doesn't make sense since the weight is 60kg, which can't happen for a 60cm person (a baby). 72 | Since we don't know how to fix this, we might decide to remove the person. This "sixty" entry also turned all Height entries into characters instead of numeric. That conversion to character also means that our summary function isn't very meaningful. So let's fix that first. 73 | 74 | ```{r} 75 | d1 <- rawdata %>% dplyr::filter( Height != "sixty" ) %>% 76 | dplyr::mutate(Height = as.numeric(Height)) 77 | skimr::skim(d1) 78 | hist(d1$Height) 79 | ``` 80 | 81 | Now we see that there is one person with a height of 6. That could be a typo, or someone mistakenly entered their height in feet. Since we unfortunately don't know, we might need to remove this person, which we'll do here. 82 | 83 | ```{r} 84 | d2 <- d1 %>% dplyr::mutate( Height = replace(Height, Height=="6",round(6*30.48,0)) ) 85 | skimr::skim(d2) 86 | ``` 87 | 88 | Height values seem ok now. 89 | 90 | Now let's look at the `Weight` variable. There is a person with weight of 7000, which is impossible, and one person with missing weight. 91 | To be able to analyze the data, we'll remove those individuals as well. 92 | 93 | ```{r} 94 | d3 <- d2 %>% dplyr::filter(Weight != 7000) %>% tidyr::drop_na() 95 | skimr::skim(d3) 96 | ``` 97 | 98 | Now checking the `Gender` variable. Gender should be a categorical/factor variable but is loaded as character. We can fix that with simple base R code to mix things up. 99 | 100 | ```{r} 101 | d3$Gender <- as.factor(d3$Gender) 102 | skimr::skim(d3) 103 | ``` 104 | 105 | 106 | Now we see that there is another NA, but it's not `NA` from R, instead it was loaded as character and is now considered as a category. 107 | Well proceed here by removing that individual with that NA entry. Since this keeps an empty category for Gender, I'm also using droplevels() to get rid of it. 108 | 109 | ```{r} 110 | d4 <- d3 %>% dplyr::filter( !(Gender %in% c("NA","N")) ) %>% droplevels() 111 | skimr::skim(d4) 112 | ``` 113 | 114 | 115 | All done, data is clean now. 116 | 117 | Let's assign at the end to some final variable, this makes it easier to add further cleaning steps above. 118 | 119 | ```{r} 120 | processeddata <- d4 121 | ``` 122 | 123 | 124 | # Save data 125 | 126 | Finally, we save the clean data as RDS file. I suggest you save your processed and cleaned data as RDS or RDA/Rdata files. 127 | This preserves coding like factors, characters, numeric, etc. If you save as CSV, that information would get lost. 128 | However, CSV is better for sharing with others since it's plain text. If you do CSV, you might want to write down somewhere what each variable is. 129 | 130 | See here for some suggestions on how to store your processed data: 131 | http://www.sthda.com/english/wiki/saving-data-into-r-data-format-rds-and-rdata 132 | 133 | ```{r} 134 | save_data_location <- here::here("data","processed-data","processeddata.rds") 135 | saveRDS(processeddata, file = save_data_location) 136 | ``` 137 | 138 | 139 | 140 | # Notes 141 | 142 | Removing anyone who had "faulty" or missing data is one approach. It's often not the best. based on your question and your analysis approach, you might want to do cleaning differently (e.g. keep individuals with some missing information). 143 | 144 | -------------------------------------------------------------------------------- /assets/dataanalysis-references.bib: -------------------------------------------------------------------------------- 1 | @article{leek2015, 2 | title = {Statistics. {{What}} Is the Question?}, 3 | author = {Leek, Jeffery T and Peng, Roger D}, 4 | year = {2015}, 5 | month = mar, 6 | journal = {Science (New York, N.Y.)}, 7 | volume = {347}, 8 | number = {6228}, 9 | pages = {1314--1315}, 10 | issn = {1095-9203}, 11 | doi = {10.1126/science.aaa6146}, 12 | __markedentry = {[andreas:6]}, 13 | citation-subset = {IM}, 14 | completed = {2015-04-14}, 15 | issn-linking = {0036-8075}, 16 | nationality = {United States}, 17 | nlm-id = {0404511}, 18 | owner = {NLM}, 19 | pii = {science.aaa6146}, 20 | pmid = {25721505}, 21 | pubmodel = {Print-Electronic}, 22 | pubstatus = {ppublish}, 23 | revised = {2015-05-01}, 24 | keywords = {Data Interpretation,Reproducibility of Results,Statistical} 25 | } 26 | 27 | @article{mckay2020, 28 | title = {Associations {{Between Relative Viral Load}} at {{Diagnosis}} and {{Influenza A Symptoms}} and {{Recovery}}.}, 29 | author = {McKay, Brian and Ebell, Mark and Billings, Wesley Zane and Dale, Ariella Perry and Shen, Ye and Handel, Andreas}, 30 | year = {2020}, 31 | month = nov, 32 | journal = {Open forum infectious diseases}, 33 | volume = {7}, 34 | number = {11}, 35 | pages = {ofaa494}, 36 | address = {{United States}}, 37 | issn = {2328-8957}, 38 | doi = {10.1093/ofid/ofaa494}, 39 | abstract = {Background: Rapid point-of-care polymerase chain reaction (PCR) diagnostic tests generally provide a qualitative result of positive or negative only. Additional information about the relative viral load could be calculated. Such quantitative information might be useful for making treatment decisions. Methods: We enrolled students at a university health center who presented with cough and 1 additional flu-like symptom from December 2016 to February 2017. Data were collected before, during, and 5 days after the clinic visit. All those enrolled in the study received a point-of-care PCR test (cobas Liat). For those patients that tested positive for influenza A, we investigated correlations between the relative viral load and measures of disease severity and recovery. Results: One hundred thirty-five students tested positive for influenza A. We found a positive correlation between viral load and body temperature. Time since symptom onset seemed to have a negative correlation but was not statistically significant. We did not find any correlations between viral load and overall symptom severity or outcomes related to recovery. Conclusions: Although we found a correlation between relative viral load and body temperature, for our study population of young, overall healthy adults, we did not find that relative viral load provided additional information that could help in determining treatment and disease outcomes. It could be that viral load does provide useful additional information for other groups of patients, such as young children or older adults. Further studies on those populations are warranted.}, 40 | copyright = {(c) The Author(s) 2020. Published by Oxford University Press on behalf of Infectious Diseases Society of America.}, 41 | langid = {english}, 42 | pmcid = {PMC7751133}, 43 | pmid = {33376754}, 44 | keywords = {infection outcomes,influenza,point-of-care testing,viral load} 45 | } 46 | 47 | @article{mckay2020a, 48 | title = {Virulence-Mediated Infectiousness and Activity Trade-Offs and Their Impact on Transmission Potential of Influenza Patients.}, 49 | author = {McKay, Brian and Ebell, Mark and Dale, Ariella Perry and Shen, Ye and Handel, Andreas}, 50 | year = {2020}, 51 | month = may, 52 | journal = {Proceedings. Biological sciences}, 53 | volume = {287}, 54 | number = {1927}, 55 | pages = {20200496}, 56 | address = {{England}}, 57 | issn = {1471-2954 0962-8452}, 58 | doi = {10.1098/rspb.2020.0496}, 59 | abstract = {Communicable diseases are often virulent, i.e. they cause morbidity symptoms in those infected. While some symptoms may be transmission- enhancing, other symptoms are likely to reduce transmission potential. For human diseases, the reduction in transmission opportunities is commonly caused by reduced activity. There is limited data regarding the potential impact of virulence on transmission potential. We performed an exploratory data analysis of 324 influenza patients at a university health centre during the 2016/2017 influenza season. We classified symptoms as infectiousness-related or morbidity-related and calculated two scores. The scores were used to explore the relationship between infectiousness, morbidity (virulence), and activity level. We found a decrease in the activity level with increasing morbidity scores. There was no consistent pattern between an activity level and an infectiousness score. We also found a positive correlation between morbidity and infectiousness scores. Overall, we find that increasing virulence leads to increased infectiousness and reduced activity, suggesting a trade-off that can impact overall transmission potential. Our findings indicate that a reduction of systemic symptoms may increase host activity without reducing infectiousness. Therefore, interventions should target both systemic- and infectiousness-related symptoms to reduce overall transmission potential. Our findings can also inform simulation models that investigate the impact of different interventions on transmission.}, 60 | langid = {english}, 61 | pmcid = {PMC7287351}, 62 | pmid = {32396798}, 63 | keywords = {*infectious diseases,*influenza,*trade-off,*transmission,*virulence,*Virulence,Humans,{Influenza, Human/*transmission}} 64 | } 65 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/quarto-html/anchor.min.js: -------------------------------------------------------------------------------- 1 | // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat 2 | // 3 | // AnchorJS - v5.0.0 - 2023-01-18 4 | // https://www.bryanbraun.com/anchorjs/ 5 | // Copyright (c) 2023 Bryan Braun; Licensed MIT 6 | // 7 | // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat 8 | !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(globalThis,function(){"use strict";return function(A){function u(A){A.icon=Object.prototype.hasOwnProperty.call(A,"icon")?A.icon:"",A.visible=Object.prototype.hasOwnProperty.call(A,"visible")?A.visible:"hover",A.placement=Object.prototype.hasOwnProperty.call(A,"placement")?A.placement:"right",A.ariaLabel=Object.prototype.hasOwnProperty.call(A,"ariaLabel")?A.ariaLabel:"Anchor",A.class=Object.prototype.hasOwnProperty.call(A,"class")?A.class:"",A.base=Object.prototype.hasOwnProperty.call(A,"base")?A.base:"",A.truncate=Object.prototype.hasOwnProperty.call(A,"truncate")?Math.floor(A.truncate):64,A.titleText=Object.prototype.hasOwnProperty.call(A,"titleText")?A.titleText:""}function d(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new TypeError("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],u(this.options),this.add=function(A){var e,t,o,i,n,s,a,r,l,c,h,p=[];if(u(this.options),0!==(e=d(A=A||"h2, h3, h4, h5, h6")).length){for(null===document.head.querySelector("style.anchorjs")&&((A=document.createElement("style")).className="anchorjs",A.appendChild(document.createTextNode("")),void 0===(h=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(A):document.head.insertBefore(A,h),A.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",A.sheet.cssRules.length),A.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",A.sheet.cssRules.length),A.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",A.sheet.cssRules.length),A.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',A.sheet.cssRules.length)),h=document.querySelectorAll("[id]"),t=[].map.call(h,function(A){return A.id}),i=0;i\]./()*\\\n\t\b\v\u00A0]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),A=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||A||!1}}}); 9 | // @license-end -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2_files/libs/quarto-html/anchor.min.js: -------------------------------------------------------------------------------- 1 | // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat 2 | // 3 | // AnchorJS - v5.0.0 - 2023-01-18 4 | // https://www.bryanbraun.com/anchorjs/ 5 | // Copyright (c) 2023 Bryan Braun; Licensed MIT 6 | // 7 | // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat 8 | !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(globalThis,function(){"use strict";return function(A){function u(A){A.icon=Object.prototype.hasOwnProperty.call(A,"icon")?A.icon:"",A.visible=Object.prototype.hasOwnProperty.call(A,"visible")?A.visible:"hover",A.placement=Object.prototype.hasOwnProperty.call(A,"placement")?A.placement:"right",A.ariaLabel=Object.prototype.hasOwnProperty.call(A,"ariaLabel")?A.ariaLabel:"Anchor",A.class=Object.prototype.hasOwnProperty.call(A,"class")?A.class:"",A.base=Object.prototype.hasOwnProperty.call(A,"base")?A.base:"",A.truncate=Object.prototype.hasOwnProperty.call(A,"truncate")?Math.floor(A.truncate):64,A.titleText=Object.prototype.hasOwnProperty.call(A,"titleText")?A.titleText:""}function d(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new TypeError("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],u(this.options),this.add=function(A){var e,t,o,i,n,s,a,r,l,c,h,p=[];if(u(this.options),0!==(e=d(A=A||"h2, h3, h4, h5, h6")).length){for(null===document.head.querySelector("style.anchorjs")&&((A=document.createElement("style")).className="anchorjs",A.appendChild(document.createTextNode("")),void 0===(h=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(A):document.head.insertBefore(A,h),A.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",A.sheet.cssRules.length),A.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",A.sheet.cssRules.length),A.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",A.sheet.cssRules.length),A.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',A.sheet.cssRules.length)),h=document.querySelectorAll("[id]"),t=[].map.call(h,function(A){return A.id}),i=0;i\]./()*\\\n\t\b\v\u00A0]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),A=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||A||!1}}}); 9 | // @license-end -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | A template file and folder structure for a data analysis project/paper done with R/Quarto/Github. Other components (e.g., other programming languages) can be added as needed. 4 | 5 | 6 | # Pre-requisites 7 | 8 | This is a template for a data analysis project using R, Quarto, Github and a reference manager that can handle bibtex. Our recommendation for the reference manager is Zotero, with the Better BibTex plugin/extension. It is also assumed that you have a word processor installed (e.g. MS Word or [LibreOffice](https://www.libreoffice.org/)). You need that software stack to make use of this template. To produce pdf output, you need a TeX distribution installed. You can use tinytex, following [these instructions.](https://quarto.org/docs/output-formats/pdf-basics.html) 9 | 10 | 11 | # Template structure and content 12 | 13 | The template comes with a folder structure and example files to illustrative the kinds of content you would place in the different folders. The following is a brief description of the contents. See the `readme` files in each folder for more details. 14 | 15 | * The `assets` folder contains static assets like manually generated schematics/diagrams, bibtex files, csl style files, PDFs of references, and other such content. These assets are not code-based and are not generated by code. Basically add anything that's you want to be part of this repo but that doesn't fit into the other categories. 16 | 17 | * All code goes into the `code` folder and subfolders. Currently, there are 3 sub-folders that do different parts of an analysis. You can re-organize such that it makes most sense for your project. The folders contain files that do some data cleaning and analysis to illustrate the overall setup and workflow. See the readme files in those folders for details. 18 | 19 | * All data goes into the `data` folder and subfolders. Currently, there are 2 sub-folders that contain different versions of a simple example data set. You can re-organize such that it makes most sense for your project. 20 | 21 | * The `products` folder and its subfolders contains deliverables, such as manuscript/report, the supplement, slide decks, posters, Shiny web apps, etc. Those should generally be made with Quarto/R. As needed, other formats can be used. There is an example manuscript and and example slide deck. 22 | - The `manuscript` subfolder contains a template for a report written as Quarto file. If you access this repository as part of [my Modern Applied Data Science course](https://andreashandel.github.io/MADAcourse/), the sections are guides for your project. If you found your way to this repository outside the course, you might only be interested in seeing how the file pulls in results and references and generates a word document as output, without paying attention to the detailed structure. There is also a sub-folder containing an example template for a supplementary material file. 23 | - The `slides` subfolder contains a basic example of slides made with Quarto. 24 | - The 'poster' subfolder contains an example of a poster made with Quarto. 25 | 26 | 27 | * The `results` folder contains automatically/code generated output. This includes figures, tables (best saved as serialized R data (`.Rds`) files), computed values and other outputs. All content in these folders should be automatically generated by code. Manually generated results should be avoided as much as possible. If absolutely necessary, they go into the `assets` folder. 28 | 29 | 30 | * There are multiple special files in the repo. 31 | * `readme.md`: this file contains instructions or details about the folder it 32 | is located in. You are reading the project-level `readme.md` file right now. There is a `readme` in almost every folder. 33 | * `data-analysis-template.Rproj` is a file that tells RStudio that this is the main folder for a project. Rename if you want. 34 | * a few "hidden" files and folders (they start with a `.` and depending on how your OS is configured, you might not see them). Those are for R/RStudio and Git/GitHub and you can ignore them. 35 | 36 | 37 | 38 | 39 | # Naming conventions 40 | 41 | We try to follow these naming conventions for folders and files: 42 | 43 | * Somewhat descriptive and easy to understand names. 44 | * Only lower-case letters (and numbers if needed). Words separated by a `-`. 45 | 46 | For instance there is a folder called `analysis-code` with a file called `exploratory-analysis-v2.qmd` in it. We don't use `_` or blank spaces for separators. We also don't use CamelCase, only lower-case. Exceptions are made for standard file names or endings, for instance R scripts end in `.R` (instead of `.r`). 47 | 48 | 49 | # Package management 50 | 51 | The package [renv](https://rstudio.github.io/renv/index.html) helps to manage R packages and increase chances of future reproducibility. Unfortunately, it creates some extra complexity and causes sometimes problems, especially for packages that are not on CRAN. 52 | 53 | You can decide to implement `renv` or not. This can happen at any stage, though earlier in the project is generally better. 54 | 55 | If you plan to use `renv`, start by reading [the introduction to `renv` article](https://rstudio.github.io/renv/articles/renv.html) so you know how to use it. 56 | 57 | 58 | # Getting started 59 | 60 | This is a Github template repository. The best way to get it and start using it is [by following these steps.](https://help.github.com/en/articles/creating-a-repository-from-a-template) 61 | 62 | Once you got the repository, you can check out the examples by executing them in order. First run the processing code, which will produce the processed data. Then run the analysis scripts, which will take the processed data and produce some results. Then you can run the manuscript, poster and slides example files in any order. Those files pull in the generated results and display them. These files also pull in references from the `bibtex` file and format them according to the CSL style. -------------------------------------------------------------------------------- /products/poster/_extensions/quarto-ext/poster/typst-template.typ: -------------------------------------------------------------------------------- 1 | 2 | #let poster( 3 | // The poster's size. 4 | size: "'36x24' or '48x36''", 5 | 6 | // The poster's title. 7 | title: "Paper Title", 8 | 9 | // A string of author names. 10 | authors: "Author Names (separated by commas)", 11 | 12 | // Department name. 13 | departments: "Department Name", 14 | 15 | // University logo. 16 | univ_logo: "Logo Path", 17 | 18 | // Footer text. 19 | // For instance, Name of Conference, Date, Location. 20 | // or Course Name, Date, Instructor. 21 | footer_text: "Footer Text", 22 | 23 | // Any URL, like a link to the conference website. 24 | footer_url: "Footer URL", 25 | 26 | // Email IDs of the authors. 27 | footer_email_ids: "Email IDs (separated by commas)", 28 | 29 | // Color of the footer. 30 | footer_color: "Hex Color Code", 31 | 32 | // DEFAULTS 33 | // ======== 34 | // For 3-column posters, these are generally good defaults. 35 | // Tested on 36in x 24in, 48in x 36in, and 36in x 48in posters. 36 | // For 2-column posters, you may need to tweak these values. 37 | // See ./examples/example_2_column_18_24.typ for an example. 38 | 39 | // Any keywords or index terms that you want to highlight at the beginning. 40 | keywords: (), 41 | 42 | // Number of columns in the poster. 43 | num_columns: "3", 44 | 45 | // University logo's scale (in %). 46 | univ_logo_scale: "100", 47 | 48 | // University logo's column size (in in). 49 | univ_logo_column_size: "10", 50 | 51 | // Title and authors' column size (in in). 52 | title_column_size: "20", 53 | 54 | // Poster title's font size (in pt). 55 | title_font_size: "48", 56 | 57 | // Authors' font size (in pt). 58 | authors_font_size: "36", 59 | 60 | // Footer's URL and email font size (in pt). 61 | footer_url_font_size: "30", 62 | 63 | // Footer's text font size (in pt). 64 | footer_text_font_size: "40", 65 | 66 | // The poster's content. 67 | body 68 | ) = { 69 | // Set the body font. 70 | set text(font: "STIX Two Text", size: 16pt) 71 | let sizes = size.split("x") 72 | let width = int(sizes.at(0)) * 1in 73 | let height = int(sizes.at(1)) * 1in 74 | univ_logo_scale = int(univ_logo_scale) * 1% 75 | title_font_size = int(title_font_size) * 1pt 76 | authors_font_size = int(authors_font_size) * 1pt 77 | num_columns = int(num_columns) 78 | univ_logo_column_size = int(univ_logo_column_size) * 1in 79 | title_column_size = int(title_column_size) * 1in 80 | footer_url_font_size = int(footer_url_font_size) * 1pt 81 | footer_text_font_size = int(footer_text_font_size) * 1pt 82 | 83 | // Configure the page. 84 | // This poster defaults to 36in x 24in. 85 | set page( 86 | width: width, 87 | height: height, 88 | margin: 89 | (top: 1in, left: 2in, right: 2in, bottom: 2in), 90 | footer: [ 91 | #set align(center) 92 | #set text(32pt) 93 | #block( 94 | fill: rgb(footer_color), 95 | width: 100%, 96 | inset: 20pt, 97 | radius: 10pt, 98 | [ 99 | #text(font: "Courier", size: footer_url_font_size, footer_url) 100 | #h(1fr) 101 | #text(size: footer_text_font_size, smallcaps(footer_text)) 102 | #h(1fr) 103 | #text(font: "Courier", size: footer_url_font_size, footer_email_ids) 104 | ] 105 | ) 106 | ] 107 | ) 108 | 109 | // Configure equation numbering and spacing. 110 | set math.equation(numbering: "(1)") 111 | show math.equation: set block(spacing: 0.65em) 112 | 113 | // Configure lists. 114 | set enum(indent: 10pt, body-indent: 9pt) 115 | set list(indent: 10pt, body-indent: 9pt) 116 | 117 | // Configure headings. 118 | set heading(numbering: "I.A.1.") 119 | show heading: it => locate(loc => { 120 | // Find out the final number of the heading counter. 121 | let levels = counter(heading).at(loc) 122 | let deepest = if levels != () { 123 | levels.last() 124 | } else { 125 | 1 126 | } 127 | 128 | set text(24pt, weight: 400) 129 | if it.level == 1 [ 130 | // First-level headings are centered smallcaps. 131 | #set align(center) 132 | #set text({ 32pt }) 133 | #show: smallcaps 134 | #v(50pt, weak: true) 135 | #if it.numbering != none { 136 | numbering("I.", deepest) 137 | h(7pt, weak: true) 138 | } 139 | #it.body 140 | #v(35.75pt, weak: true) 141 | #line(length: 100%) 142 | ] else if it.level == 2 [ 143 | // Second-level headings are run-ins. 144 | #set text(style: "italic") 145 | #v(32pt, weak: true) 146 | #if it.numbering != none { 147 | numbering("i.", deepest) 148 | h(7pt, weak: true) 149 | } 150 | #it.body 151 | #v(10pt, weak: true) 152 | ] else [ 153 | // Third level headings are run-ins too, but different. 154 | #if it.level == 3 { 155 | numbering("1)", deepest) 156 | [ ] 157 | } 158 | _#(it.body):_ 159 | ] 160 | }) 161 | 162 | // Arranging the logo, title, authors, and department in the header. 163 | align(center, 164 | grid( 165 | rows: 2, 166 | columns: (univ_logo_column_size, title_column_size), 167 | column-gutter: 0pt, 168 | row-gutter: 50pt, 169 | image(univ_logo, width: univ_logo_scale), 170 | text(title_font_size, title + "\n\n") + 171 | text(authors_font_size, emph(authors) + 172 | " (" + departments + ") "), 173 | ) 174 | ) 175 | 176 | // Start three column mode and configure paragraph properties. 177 | show: columns.with(num_columns, gutter: 64pt) 178 | set par(justify: true, first-line-indent: 0em) 179 | show par: set block(spacing: 0.65em) 180 | 181 | // Display the keywords. 182 | if keywords != () [ 183 | #set text(24pt, weight: 400) 184 | #show "Keywords": smallcaps 185 | *Keywords* --- #keywords.join(", ") 186 | ] 187 | 188 | // Display the poster's contents. 189 | body 190 | } -------------------------------------------------------------------------------- /assets/american-journal-of-epidemiology.csl: -------------------------------------------------------------------------------- 1 | 2 | 157 | -------------------------------------------------------------------------------- /code/processing-code/processingcode.R: -------------------------------------------------------------------------------- 1 | ############################### 2 | # processing script 3 | # 4 | #this script loads the raw data, processes and cleans it 5 | #and saves it as Rds file in the processed-data folder 6 | # 7 | # Note the ## ---- name ---- notation 8 | # This is done so one can pull in the chunks of code into the Quarto document 9 | # see here: https://bookdown.org/yihui/rmarkdown-cookbook/read-chunk.html 10 | ############################### 11 | 12 | 13 | ## ---- packages -------- 14 | #load needed packages. make sure they are installed. 15 | library(readxl) #for loading Excel files 16 | library(dplyr) #for data processing/cleaning 17 | library(tidyr) #for data processing/cleaning 18 | library(skimr) #for nice visualization of data 19 | library(here) #to set paths 20 | 21 | 22 | ## ---- loaddata -------- 23 | #path to data 24 | #note the use of the here() package and not absolute paths 25 | data_location <- here::here("data","raw-data","exampledata.xlsx") 26 | #load data. 27 | #note that for functions that come from specific packages (instead of base R) 28 | # I often specify both package and function like so 29 | #package::function() that's not required one could just call the function 30 | #specifying the package makes it clearer where the function "lives", 31 | #but it adds typing. You can do it either way. 32 | rawdata <- readxl::read_excel(data_location) 33 | # We might also want to load the codebook to look at it 34 | codebook <- readxl::read_excel(data_location, sheet ="Codebook") 35 | 36 | 37 | ## ---- exploredata -------- 38 | #take a look at the data 39 | dplyr::glimpse(rawdata) 40 | #another way to look at the data 41 | summary(rawdata) 42 | #yet another way to get an idea of the data 43 | head(rawdata) 44 | #this is a nice way to look at data 45 | skimr::skim(rawdata) 46 | #look in the Codebook for a variable explanation 47 | print(codebook) 48 | 49 | 50 | ## ---- cleandata1 -------- 51 | # Inspecting the data, we find some problems that need addressing: 52 | # First, there is an entry for height which says "sixty" instead of a number. 53 | # Does that mean it should be a numeric 60? It somehow doesn't make 54 | # sense since the weight is 60kg, which can't happen for a 60cm person (a baby) 55 | # Since we don't know how to fix this, we might decide to remove the person. 56 | # This "sixty" entry also turned all Height entries into characters instead of numeric. 57 | # That conversion to character also means that our summary function isn't very meaningful. 58 | # So let's fix that first. 59 | d1 <- rawdata %>% dplyr::filter( Height != "sixty" ) %>% 60 | dplyr::mutate(Height = as.numeric(Height)) 61 | # look at partially fixed data again 62 | skimr::skim(d1) 63 | hist(d1$Height) 64 | 65 | 66 | ## ---- cleandata2 -------- 67 | # Now we see that there is one person with a height of 6. 68 | # that could be a typo, or someone mistakenly entered their height in feet. 69 | # If we don't know, we might need to remove this person. 70 | # But let's assume that we somehow know that this is meant to be 6 feet, so we can convert to centimeters. 71 | d2 <- d1 %>% dplyr::mutate( Height = replace(Height, Height=="6",round(6*30.48,0)) ) 72 | #height values seem ok now 73 | skimr::skim(d2) 74 | 75 | 76 | ## ---- cleandata3 -------- 77 | # now let's look at weight 78 | # there is a person with weight of 7000, which is impossible, 79 | # and one person with missing weight. 80 | # Note that the original data had an empty cell. 81 | # The codebook says that's not allowed, it should have been NA. 82 | # R automatically converts empty values to NA. 83 | # If you don't want that, you can adjust it when you load the data. 84 | # to be able to analyze the data, we'll remove those individuals as well. 85 | # Note: Some analysis methods can deal with missing values, so it's not always necessary to remove them. 86 | # This should be adjusted based on your planned analysis approach. 87 | d3 <- d2 %>% dplyr::filter(Weight != 7000) %>% tidyr::drop_na() 88 | skimr::skim(d3) 89 | 90 | 91 | ## ---- cleandata4 -------- 92 | # We also want to have Gender coded as a categorical/factor variable 93 | # we can do that with simple base R code to mix things up 94 | d3$Gender <- as.factor(d3$Gender) 95 | skimr::skim(d3) 96 | 97 | 98 | ## ---- cleandata5 -------- 99 | #now we see that there is another NA, but it's not "NA" from R 100 | #instead it was loaded as character and is now considered as a category. 101 | #There is also an individual coded as "N" which is not allowed. 102 | #This could be mistyped M or a mistyped NA. If we have a good guess, we could adjust. 103 | #If we don't we might need to remove that individual. 104 | #well proceed here by removing both the NA and N individuals 105 | #since this keeps an empty category, I'm also using droplevels() to get rid of it 106 | d4 <- d3 %>% dplyr::filter( !(Gender %in% c("NA","N")) ) %>% droplevels() 107 | skimr::skim(d4) 108 | 109 | 110 | ## ---- savedata -------- 111 | # all done, data is clean now. 112 | # Let's assign at the end to some final variable 113 | # makes it easier to add steps above 114 | processeddata <- d4 115 | # location to save file 116 | save_data_location <- here::here("data","processed-data","processeddata.rds") 117 | saveRDS(processeddata, file = save_data_location) 118 | 119 | 120 | 121 | ## ---- notes -------- 122 | # anything you don't want loaded into the Quarto file but 123 | # keep in the R file, just give it its own label and then don't include that label 124 | # in the Quarto file 125 | 126 | # Dealing with NA or "bad" data: 127 | # removing anyone who had "faulty" or missing data is one approach. 128 | # it's often not the best. based on your question and your analysis approach, 129 | # you might want to do cleaning differently (e.g. keep individuals with some missing information) 130 | 131 | # Saving data as RDS: 132 | # I suggest you save your processed and cleaned data as RDS or RDA/Rdata files. 133 | # This preserves coding like factors, characters, numeric, etc. 134 | # If you save as CSV, that information would get lost. 135 | # However, CSV is better for sharing with others since it's plain text. 136 | # If you do CSV, you might want to write down somewhere what each variable is. 137 | # See here for some suggestions on how to store your processed data: 138 | # http://www.sthda.com/english/wiki/saving-data-into-r-data-format-rds-and-rdata 139 | -------------------------------------------------------------------------------- /products/manuscript/Manuscript.qmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Example Manuscript Template for a Data Analysis Project" 3 | author: "" 4 | format: 5 | docx: 6 | toc: false 7 | number-sections: true 8 | highlight-style: github 9 | bibliography: ../../assets/dataanalysis-references.bib 10 | csl: ../../assets/american-journal-of-epidemiology.csl 11 | --- 12 | 13 | 14 | 15 | 16 | The structure below is one possible setup for a manuscript, or a general data analysis project (including the course project). Adjust as needed. 17 | You don't need to have exactly these sections, but the content covering those sections should be addressed. 18 | 19 | This uses MS Word as output format. [See here](https://quarto.org/docs/output-formats/ms-word.html) for more information. You can switch to other formats, like html or pdf. See [the Quarto documentation](https://quarto.org/) for other formats. 20 | 21 | 22 | ```{r, echo=FALSE, message=FALSE} 23 | # load a few R packages 24 | library(here) 25 | library(knitr) 26 | ``` 27 | 28 | 29 | **Authors** 30 | 31 | * First Autor$^{1,2,*}$ (ORCID: 0000-0000-1234-5678) 32 | * Second Author$^{3, *}$ 33 | * Third Autor$^{3, \dagger}$ 34 | * Last Author$^{1, 2, \land}$ 35 | 36 | **Author affiliations** 37 | 38 | 1. College of Public Health, University of Georgia, Athens, GA, USA. 39 | 2. Another Affiliation, Athens, GA, USA. 40 | 3. Yet another Affiliation. 41 | 42 | $*$ These authors contributed equally to this work. 43 | 44 | $\land$ Corresponding author: some@email.com 45 | 46 | $\dagger$ Disclaimer: The opinions expressed in this article are the 47 | author's own and don't reflect their employer. 48 | 49 | 50 | {{< pagebreak >}} 51 | 52 | 53 | 54 | # Summary/Abstract 55 | _Write a summary of your project._ 56 | 57 | _It is recommended to use a structured abstract with Background/Methods/Results/Discussion sections._ 58 | 59 | {{< pagebreak >}} 60 | 61 | 62 | # Introduction 63 | 64 | ## General Background Information 65 | _Provide enough background on your topic that others can understand the why and how of your analysis_ 66 | 67 | ## Description of data and data source 68 | _Describe what the data is, what it contains, where it is from, etc. Eventually this might be part of a methods section._ 69 | 70 | ## Questions/Hypotheses to be addressed 71 | _State the research questions you plan to answer with this analysis._ 72 | 73 | To cite other work (important everywhere, but likely happens first in introduction), make sure your references are in the bibtex file specified in the YAML header above and have the right bibtex key. Then you can include like this: 74 | 75 | Examples of reproducible research projects can for instance be found in [@mckay2020; @mckay2020a]. 76 | 77 | 78 | 79 | {{< pagebreak >}} 80 | 81 | 82 | # Methods 83 | 84 | _Describe your methods. That should describe the data, the cleaning processes, and the analysis approaches. You might want to provide a shorter description here and all the details in the supplement._ 85 | 86 | 87 | ## Schematic of workflow 88 | 89 | Sometimes you might want to show a schematic diagram/figure that was not created with code (if you can do it with code, do it). @fig-schematic is an example of some - completely random/unrelated - schematic that was generated with Biorender. 90 | We store those figures in the `assets` folder. 91 | 92 | ```{r} 93 | #| label: fig-schematic 94 | #| fig-cap: "A figure that is manually generated and shows some overview/schematic. This has nothing to do with the data, it's just a random one from one of our projects I found and placed here." 95 | #| echo: FALSE 96 | knitr::include_graphics(here("assets","antigen-recognition.png")) 97 | ``` 98 | 99 | 100 | 101 | 102 | ## Data aquisition 103 | _As applicable, explain where and how you got the data. If you directly import the data from an online source, you can combine this section with the next._ 104 | 105 | 106 | ## Data import and cleaning 107 | _Write code that reads in the file and cleans it so it's ready for analysis. Since this will be fairly long code for most datasets, it might be a good idea to have it in one or several R scripts. If that is the case, explain here briefly what kind of cleaning/processing you do, and provide more details and well documented code somewhere (e.g. as supplement in a paper). All materials, including files that contain code, should be commented well so everyone can follow along._ 108 | 109 | 110 | ## Statistical analysis 111 | _Explain anything related to your statistical analyses._ 112 | 113 | 114 | {{< pagebreak >}} 115 | 116 | 117 | # Results 118 | 119 | ## Exploratory/Descriptive analysis 120 | 121 | _Use a combination of text/tables/figures to explore and describe your data. Show the most important descriptive results here. Additional ones should go in the supplement. Even more can be in the R and Quarto files that are part of your project._ 122 | 123 | 124 | @tbl-summarytable shows a summary of the data. 125 | 126 | Note the loading of the data providing a **relative** path using the `../../` notation. (Two dots means a folder up). You never want to specify an **absolute** path like `C:\ahandel\myproject\results\` because if you share this with someone, it won't work for them since they don't have that path. You can also use the `here` R package to create paths. See examples of that below. I generally recommend the `here` package. 127 | 128 | ```{r} 129 | #| label: tbl-summarytable 130 | #| tbl-cap: "Data summary table." 131 | #| echo: FALSE 132 | resulttable <- readRDS("../../results/tables/summarytable.rds") 133 | knitr::kable(resulttable) 134 | ``` 135 | 136 | 137 | 138 | ## Basic statistical analysis 139 | 140 | _To get some further insight into your data, if reasonable you could compute simple statistics (e.g. simple models with 1 predictor) to look for associations between your outcome(s) and each individual predictor variable. Though note that unless you pre-specified the outcome and main exposure, any "p<0.05 means statistical significance" interpretation is not valid._ 141 | 142 | 143 | @fig-result shows a scatterplot figure produced by one of the R scripts. 144 | 145 | ```{r} 146 | #| label: fig-result 147 | #| fig-cap: "Height and weight stratified by gender." 148 | #| echo: FALSE 149 | knitr::include_graphics(here("results","figures","height-weight-stratified.png")) 150 | ``` 151 | 152 | 153 | ## Full analysis 154 | 155 | _Use one or several suitable statistical/machine learning methods to analyze your data and to produce meaningful figures, tables, etc. This might again be code that is best placed in one or several separate R scripts that need to be well documented. You want the code to produce figures and data ready for display as tables, and save those. Then you load them here._ 156 | 157 | Example @tbl-resulttable2 shows a summary of a linear model fit. 158 | 159 | ```{r} 160 | #| label: tbl-resulttable2 161 | #| tbl-cap: "Linear model fit table." 162 | #| echo: FALSE 163 | resulttable2 <- readRDS(here("results","tables","resulttable2.rds")) 164 | knitr::kable(resulttable2) 165 | ``` 166 | 167 | 168 | {{< pagebreak >}} 169 | 170 | 171 | # Discussion 172 | 173 | ## Summary and Interpretation 174 | _Summarize what you did, what you found and what it means._ 175 | 176 | ## Strengths and Limitations 177 | _Discuss what you perceive as strengths and limitations of your analysis._ 178 | 179 | ## Conclusions 180 | _What are the main take-home messages?_ 181 | 182 | _Include citations in your Rmd file using bibtex, the list of references will automatically be placed at the end_ 183 | 184 | This paper [@leek2015] discusses types of analyses. 185 | 186 | These papers [@mckay2020; @mckay2020a] are good examples of papers published using a fully reproducible setup similar to the one shown in this template. 187 | 188 | Note that this cited reference will show up at the end of the document, the reference formatting is determined by the CSL file specified in the YAML header. Many more style files for almost any journal [are available](https://www.zotero.org/styles). You also specify the location of your bibtex reference file in the YAML. You can call your reference file anything you like. 189 | 190 | 191 | {{< pagebreak >}} 192 | 193 | # References 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/clipboard/clipboard.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * clipboard.js v2.0.11 3 | * https://clipboardjs.com/ 4 | * 5 | * Licensed MIT © Zeno Rocha 6 | */ 7 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1 2 | 348 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/quarto-html/popper.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @popperjs/core v2.11.7 - MIT License 3 | */ 4 | 5 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,(function(e){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function o(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var i=Math.max,a=Math.min,s=Math.round;function f(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function c(){return!/^((?!chrome|android).)*safari/i.test(f())}function p(e,o,i){void 0===o&&(o=!1),void 0===i&&(i=!1);var a=e.getBoundingClientRect(),f=1,p=1;o&&r(e)&&(f=e.offsetWidth>0&&s(a.width)/e.offsetWidth||1,p=e.offsetHeight>0&&s(a.height)/e.offsetHeight||1);var u=(n(e)?t(e):window).visualViewport,l=!c()&&i,d=(a.left+(l&&u?u.offsetLeft:0))/f,h=(a.top+(l&&u?u.offsetTop:0))/p,m=a.width/f,v=a.height/p;return{width:m,height:v,top:h,right:d+m,bottom:h+v,left:d,x:d,y:h}}function u(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function l(e){return e?(e.nodeName||"").toLowerCase():null}function d(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function h(e){return p(d(e)).left+u(e).scrollLeft}function m(e){return t(e).getComputedStyle(e)}function v(e){var t=m(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function y(e,n,o){void 0===o&&(o=!1);var i,a,f=r(n),c=r(n)&&function(e){var t=e.getBoundingClientRect(),n=s(t.width)/e.offsetWidth||1,r=s(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(n),m=d(n),y=p(e,c,o),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(f||!f&&!o)&&(("body"!==l(n)||v(m))&&(g=(i=n)!==t(i)&&r(i)?{scrollLeft:(a=i).scrollLeft,scrollTop:a.scrollTop}:u(i)),r(n)?((b=p(n,!0)).x+=n.clientLeft,b.y+=n.clientTop):m&&(b.x=h(m))),{x:y.left+g.scrollLeft-b.x,y:y.top+g.scrollTop-b.y,width:y.width,height:y.height}}function g(e){var t=p(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function b(e){return"html"===l(e)?e:e.assignedSlot||e.parentNode||(o(e)?e.host:null)||d(e)}function x(e){return["html","body","#document"].indexOf(l(e))>=0?e.ownerDocument.body:r(e)&&v(e)?e:x(b(e))}function w(e,n){var r;void 0===n&&(n=[]);var o=x(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=t(o),s=i?[a].concat(a.visualViewport||[],v(o)?o:[]):o,f=n.concat(s);return i?f:f.concat(w(b(s)))}function O(e){return["table","td","th"].indexOf(l(e))>=0}function j(e){return r(e)&&"fixed"!==m(e).position?e.offsetParent:null}function E(e){for(var n=t(e),i=j(e);i&&O(i)&&"static"===m(i).position;)i=j(i);return i&&("html"===l(i)||"body"===l(i)&&"static"===m(i).position)?n:i||function(e){var t=/firefox/i.test(f());if(/Trident/i.test(f())&&r(e)&&"fixed"===m(e).position)return null;var n=b(e);for(o(n)&&(n=n.host);r(n)&&["html","body"].indexOf(l(n))<0;){var i=m(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var D="top",A="bottom",L="right",P="left",M="auto",k=[D,A,L,P],W="start",B="end",H="viewport",T="popper",R=k.reduce((function(e,t){return e.concat([t+"-"+W,t+"-"+B])}),[]),S=[].concat(k,[M]).reduce((function(e,t){return e.concat([t,t+"-"+W,t+"-"+B])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function q(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}function C(e){return e.split("-")[0]}function N(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function I(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function _(e,r,o){return r===H?I(function(e,n){var r=t(e),o=d(e),i=r.visualViewport,a=o.clientWidth,s=o.clientHeight,f=0,p=0;if(i){a=i.width,s=i.height;var u=c();(u||!u&&"fixed"===n)&&(f=i.offsetLeft,p=i.offsetTop)}return{width:a,height:s,x:f+h(e),y:p}}(e,o)):n(r)?function(e,t){var n=p(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(r,o):I(function(e){var t,n=d(e),r=u(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=i(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=i(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+h(e),c=-r.scrollTop;return"rtl"===m(o||n).direction&&(f+=i(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:s,x:f,y:c}}(d(e)))}function F(e,t,o,s){var f="clippingParents"===t?function(e){var t=w(b(e)),o=["absolute","fixed"].indexOf(m(e).position)>=0&&r(e)?E(e):e;return n(o)?t.filter((function(e){return n(e)&&N(e,o)&&"body"!==l(e)})):[]}(e):[].concat(t),c=[].concat(f,[o]),p=c[0],u=c.reduce((function(t,n){var r=_(e,n,s);return t.top=i(r.top,t.top),t.right=a(r.right,t.right),t.bottom=a(r.bottom,t.bottom),t.left=i(r.left,t.left),t}),_(e,p,s));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function U(e){return e.split("-")[1]}function z(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function X(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?C(o):null,a=o?U(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case D:t={x:s,y:n.y-r.height};break;case A:t={x:s,y:n.y+n.height};break;case L:t={x:n.x+n.width,y:f};break;case P:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?z(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case W:t[c]=t[c]-(n[p]/2-r[p]/2);break;case B:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}function Y(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function G(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function J(e,t){void 0===t&&(t={});var r=t,o=r.placement,i=void 0===o?e.placement:o,a=r.strategy,s=void 0===a?e.strategy:a,f=r.boundary,c=void 0===f?"clippingParents":f,u=r.rootBoundary,l=void 0===u?H:u,h=r.elementContext,m=void 0===h?T:h,v=r.altBoundary,y=void 0!==v&&v,g=r.padding,b=void 0===g?0:g,x=Y("number"!=typeof b?b:G(b,k)),w=m===T?"reference":T,O=e.rects.popper,j=e.elements[y?w:m],E=F(n(j)?j:j.contextElement||d(e.elements.popper),c,l,s),P=p(e.elements.reference),M=X({reference:P,element:O,strategy:"absolute",placement:i}),W=I(Object.assign({},O,M)),B=m===T?W:P,R={top:E.top-B.top+x.top,bottom:B.bottom-E.bottom+x.bottom,left:E.left-B.left+x.left,right:B.right-E.right+x.right},S=e.modifiersData.offset;if(m===T&&S){var V=S[i];Object.keys(R).forEach((function(e){var t=[L,A].indexOf(e)>=0?1:-1,n=[D,A].indexOf(e)>=0?"y":"x";R[e]+=V[n]*t}))}return R}var K={placement:"bottom",modifiers:[],strategy:"absolute"};function Q(){for(var e=arguments.length,t=new Array(e),n=0;n=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P,L].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},se={left:"right",right:"left",bottom:"top",top:"bottom"};function fe(e){return e.replace(/left|right|bottom|top/g,(function(e){return se[e]}))}var ce={start:"end",end:"start"};function pe(e){return e.replace(/start|end/g,(function(e){return ce[e]}))}function ue(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?S:f,p=U(r),u=p?s?R:R.filter((function(e){return U(e)===p})):k,l=u.filter((function(e){return c.indexOf(e)>=0}));0===l.length&&(l=u);var d=l.reduce((function(t,n){return t[n]=J(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[C(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}var le={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,y=C(v),g=f||(y===v||!h?[fe(v)]:function(e){if(C(e)===M)return[];var t=fe(e);return[pe(e),t,pe(t)]}(v)),b=[v].concat(g).reduce((function(e,n){return e.concat(C(n)===M?ue(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)}),[]),x=t.rects.reference,w=t.rects.popper,O=new Map,j=!0,E=b[0],k=0;k=0,S=R?"width":"height",V=J(t,{placement:B,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),q=R?T?L:P:T?A:D;x[S]>w[S]&&(q=fe(q));var N=fe(q),I=[];if(i&&I.push(V[H]<=0),s&&I.push(V[q]<=0,V[N]<=0),I.every((function(e){return e}))){E=B,j=!1;break}O.set(B,I)}if(j)for(var _=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},F=h?3:1;F>0;F--){if("break"===_(F))break}t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function de(e,t,n){return i(e,a(t,n))}var he={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=void 0===o||o,f=n.altAxis,c=void 0!==f&&f,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,v=n.tetherOffset,y=void 0===v?0:v,b=J(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),x=C(t.placement),w=U(t.placement),O=!w,j=z(x),M="x"===j?"y":"x",k=t.modifiersData.popperOffsets,B=t.rects.reference,H=t.rects.popper,T="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(k){if(s){var q,N="y"===j?D:P,I="y"===j?A:L,_="y"===j?"height":"width",F=k[j],X=F+b[N],Y=F-b[I],G=m?-H[_]/2:0,K=w===W?B[_]:H[_],Q=w===W?-H[_]:-B[_],Z=t.elements.arrow,$=m&&Z?g(Z):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[N],ne=ee[I],re=de(0,B[_],$[_]),oe=O?B[_]/2-G-re-te-R.mainAxis:K-re-te-R.mainAxis,ie=O?-B[_]/2+G+re+ne+R.mainAxis:Q+re+ne+R.mainAxis,ae=t.elements.arrow&&E(t.elements.arrow),se=ae?"y"===j?ae.clientTop||0:ae.clientLeft||0:0,fe=null!=(q=null==S?void 0:S[j])?q:0,ce=F+ie-fe,pe=de(m?a(X,F+oe-fe-se):X,F,m?i(Y,ce):Y);k[j]=pe,V[j]=pe-F}if(c){var ue,le="x"===j?D:P,he="x"===j?A:L,me=k[M],ve="y"===M?"height":"width",ye=me+b[le],ge=me-b[he],be=-1!==[D,P].indexOf(x),xe=null!=(ue=null==S?void 0:S[M])?ue:0,we=be?ye:me-B[ve]-H[ve]-xe+R.altAxis,Oe=be?me+B[ve]+H[ve]-xe-R.altAxis:ge,je=m&&be?function(e,t,n){var r=de(e,t,n);return r>n?n:r}(we,me,Oe):de(m?we:ye,me,m?Oe:ge);k[M]=je,V[M]=je-me}t.modifiersData[r]=V}},requiresIfExists:["offset"]};var me={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=C(n.placement),f=z(s),c=[P,L].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return Y("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:G(e,k))}(o.padding,n),u=g(i),l="y"===f?D:P,d="y"===f?A:L,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],v=E(i),y=v?"y"===f?v.clientHeight||0:v.clientWidth||0:0,b=h/2-m/2,x=p[l],w=y-u[c]-p[d],O=y/2-u[c]/2+b,j=de(x,O,w),M=f;n.modifiersData[r]=((t={})[M]=j,t.centerOffset=j-O,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&N(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ve(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function ye(e){return[D,L,A,P].some((function(t){return e[t]>=0}))}var ge={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=J(t,{elementContext:"reference"}),s=J(t,{altBoundary:!0}),f=ve(a,r),c=ve(s,o,i),p=ye(f),u=ye(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}},be=Z({defaultModifiers:[ee,te,oe,ie]}),xe=[ee,te,oe,ie,ae,le,he,me,ge],we=Z({defaultModifiers:xe});e.applyStyles=ie,e.arrow=me,e.computeStyles=oe,e.createPopper=we,e.createPopperLite=be,e.defaultModifiers=xe,e.detectOverflow=J,e.eventListeners=ee,e.flip=le,e.hide=ge,e.offset=ae,e.popperGenerator=Z,e.popperOffsets=te,e.preventOverflow=he,Object.defineProperty(e,"__esModule",{value:!0})})); 6 | 7 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v2_files/libs/quarto-html/popper.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @popperjs/core v2.11.7 - MIT License 3 | */ 4 | 5 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Popper={})}(this,(function(e){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function n(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function o(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}var i=Math.max,a=Math.min,s=Math.round;function f(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function c(){return!/^((?!chrome|android).)*safari/i.test(f())}function p(e,o,i){void 0===o&&(o=!1),void 0===i&&(i=!1);var a=e.getBoundingClientRect(),f=1,p=1;o&&r(e)&&(f=e.offsetWidth>0&&s(a.width)/e.offsetWidth||1,p=e.offsetHeight>0&&s(a.height)/e.offsetHeight||1);var u=(n(e)?t(e):window).visualViewport,l=!c()&&i,d=(a.left+(l&&u?u.offsetLeft:0))/f,h=(a.top+(l&&u?u.offsetTop:0))/p,m=a.width/f,v=a.height/p;return{width:m,height:v,top:h,right:d+m,bottom:h+v,left:d,x:d,y:h}}function u(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function l(e){return e?(e.nodeName||"").toLowerCase():null}function d(e){return((n(e)?e.ownerDocument:e.document)||window.document).documentElement}function h(e){return p(d(e)).left+u(e).scrollLeft}function m(e){return t(e).getComputedStyle(e)}function v(e){var t=m(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function y(e,n,o){void 0===o&&(o=!1);var i,a,f=r(n),c=r(n)&&function(e){var t=e.getBoundingClientRect(),n=s(t.width)/e.offsetWidth||1,r=s(t.height)/e.offsetHeight||1;return 1!==n||1!==r}(n),m=d(n),y=p(e,c,o),g={scrollLeft:0,scrollTop:0},b={x:0,y:0};return(f||!f&&!o)&&(("body"!==l(n)||v(m))&&(g=(i=n)!==t(i)&&r(i)?{scrollLeft:(a=i).scrollLeft,scrollTop:a.scrollTop}:u(i)),r(n)?((b=p(n,!0)).x+=n.clientLeft,b.y+=n.clientTop):m&&(b.x=h(m))),{x:y.left+g.scrollLeft-b.x,y:y.top+g.scrollTop-b.y,width:y.width,height:y.height}}function g(e){var t=p(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function b(e){return"html"===l(e)?e:e.assignedSlot||e.parentNode||(o(e)?e.host:null)||d(e)}function x(e){return["html","body","#document"].indexOf(l(e))>=0?e.ownerDocument.body:r(e)&&v(e)?e:x(b(e))}function w(e,n){var r;void 0===n&&(n=[]);var o=x(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=t(o),s=i?[a].concat(a.visualViewport||[],v(o)?o:[]):o,f=n.concat(s);return i?f:f.concat(w(b(s)))}function O(e){return["table","td","th"].indexOf(l(e))>=0}function j(e){return r(e)&&"fixed"!==m(e).position?e.offsetParent:null}function E(e){for(var n=t(e),i=j(e);i&&O(i)&&"static"===m(i).position;)i=j(i);return i&&("html"===l(i)||"body"===l(i)&&"static"===m(i).position)?n:i||function(e){var t=/firefox/i.test(f());if(/Trident/i.test(f())&&r(e)&&"fixed"===m(e).position)return null;var n=b(e);for(o(n)&&(n=n.host);r(n)&&["html","body"].indexOf(l(n))<0;){var i=m(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var D="top",A="bottom",L="right",P="left",M="auto",k=[D,A,L,P],W="start",B="end",H="viewport",T="popper",R=k.reduce((function(e,t){return e.concat([t+"-"+W,t+"-"+B])}),[]),S=[].concat(k,[M]).reduce((function(e,t){return e.concat([t,t+"-"+W,t+"-"+B])}),[]),V=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function q(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}function C(e){return e.split("-")[0]}function N(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&o(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function I(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function _(e,r,o){return r===H?I(function(e,n){var r=t(e),o=d(e),i=r.visualViewport,a=o.clientWidth,s=o.clientHeight,f=0,p=0;if(i){a=i.width,s=i.height;var u=c();(u||!u&&"fixed"===n)&&(f=i.offsetLeft,p=i.offsetTop)}return{width:a,height:s,x:f+h(e),y:p}}(e,o)):n(r)?function(e,t){var n=p(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}(r,o):I(function(e){var t,n=d(e),r=u(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=i(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=i(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),f=-r.scrollLeft+h(e),c=-r.scrollTop;return"rtl"===m(o||n).direction&&(f+=i(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:s,x:f,y:c}}(d(e)))}function F(e,t,o,s){var f="clippingParents"===t?function(e){var t=w(b(e)),o=["absolute","fixed"].indexOf(m(e).position)>=0&&r(e)?E(e):e;return n(o)?t.filter((function(e){return n(e)&&N(e,o)&&"body"!==l(e)})):[]}(e):[].concat(t),c=[].concat(f,[o]),p=c[0],u=c.reduce((function(t,n){var r=_(e,n,s);return t.top=i(r.top,t.top),t.right=a(r.right,t.right),t.bottom=a(r.bottom,t.bottom),t.left=i(r.left,t.left),t}),_(e,p,s));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function U(e){return e.split("-")[1]}function z(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function X(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?C(o):null,a=o?U(o):null,s=n.x+n.width/2-r.width/2,f=n.y+n.height/2-r.height/2;switch(i){case D:t={x:s,y:n.y-r.height};break;case A:t={x:s,y:n.y+n.height};break;case L:t={x:n.x+n.width,y:f};break;case P:t={x:n.x-r.width,y:f};break;default:t={x:n.x,y:n.y}}var c=i?z(i):null;if(null!=c){var p="y"===c?"height":"width";switch(a){case W:t[c]=t[c]-(n[p]/2-r[p]/2);break;case B:t[c]=t[c]+(n[p]/2-r[p]/2)}}return t}function Y(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function G(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function J(e,t){void 0===t&&(t={});var r=t,o=r.placement,i=void 0===o?e.placement:o,a=r.strategy,s=void 0===a?e.strategy:a,f=r.boundary,c=void 0===f?"clippingParents":f,u=r.rootBoundary,l=void 0===u?H:u,h=r.elementContext,m=void 0===h?T:h,v=r.altBoundary,y=void 0!==v&&v,g=r.padding,b=void 0===g?0:g,x=Y("number"!=typeof b?b:G(b,k)),w=m===T?"reference":T,O=e.rects.popper,j=e.elements[y?w:m],E=F(n(j)?j:j.contextElement||d(e.elements.popper),c,l,s),P=p(e.elements.reference),M=X({reference:P,element:O,strategy:"absolute",placement:i}),W=I(Object.assign({},O,M)),B=m===T?W:P,R={top:E.top-B.top+x.top,bottom:B.bottom-E.bottom+x.bottom,left:E.left-B.left+x.left,right:B.right-E.right+x.right},S=e.modifiersData.offset;if(m===T&&S){var V=S[i];Object.keys(R).forEach((function(e){var t=[L,A].indexOf(e)>=0?1:-1,n=[D,A].indexOf(e)>=0?"y":"x";R[e]+=V[n]*t}))}return R}var K={placement:"bottom",modifiers:[],strategy:"absolute"};function Q(){for(var e=arguments.length,t=new Array(e),n=0;n=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P,L].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],f=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=a}},se={left:"right",right:"left",bottom:"top",top:"bottom"};function fe(e){return e.replace(/left|right|bottom|top/g,(function(e){return se[e]}))}var ce={start:"end",end:"start"};function pe(e){return e.replace(/start|end/g,(function(e){return ce[e]}))}function ue(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=void 0===f?S:f,p=U(r),u=p?s?R:R.filter((function(e){return U(e)===p})):k,l=u.filter((function(e){return c.indexOf(e)>=0}));0===l.length&&(l=u);var d=l.reduce((function(t,n){return t[n]=J(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[C(n)],t}),{});return Object.keys(d).sort((function(e,t){return d[e]-d[t]}))}var le={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,f=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,v=t.options.placement,y=C(v),g=f||(y===v||!h?[fe(v)]:function(e){if(C(e)===M)return[];var t=fe(e);return[pe(e),t,pe(t)]}(v)),b=[v].concat(g).reduce((function(e,n){return e.concat(C(n)===M?ue(t,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)}),[]),x=t.rects.reference,w=t.rects.popper,O=new Map,j=!0,E=b[0],k=0;k=0,S=R?"width":"height",V=J(t,{placement:B,boundary:p,rootBoundary:u,altBoundary:l,padding:c}),q=R?T?L:P:T?A:D;x[S]>w[S]&&(q=fe(q));var N=fe(q),I=[];if(i&&I.push(V[H]<=0),s&&I.push(V[q]<=0,V[N]<=0),I.every((function(e){return e}))){E=B,j=!1;break}O.set(B,I)}if(j)for(var _=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return E=t,"break"},F=h?3:1;F>0;F--){if("break"===_(F))break}t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function de(e,t,n){return i(e,a(t,n))}var he={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=void 0===o||o,f=n.altAxis,c=void 0!==f&&f,p=n.boundary,u=n.rootBoundary,l=n.altBoundary,d=n.padding,h=n.tether,m=void 0===h||h,v=n.tetherOffset,y=void 0===v?0:v,b=J(t,{boundary:p,rootBoundary:u,padding:d,altBoundary:l}),x=C(t.placement),w=U(t.placement),O=!w,j=z(x),M="x"===j?"y":"x",k=t.modifiersData.popperOffsets,B=t.rects.reference,H=t.rects.popper,T="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,R="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),S=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,V={x:0,y:0};if(k){if(s){var q,N="y"===j?D:P,I="y"===j?A:L,_="y"===j?"height":"width",F=k[j],X=F+b[N],Y=F-b[I],G=m?-H[_]/2:0,K=w===W?B[_]:H[_],Q=w===W?-H[_]:-B[_],Z=t.elements.arrow,$=m&&Z?g(Z):{width:0,height:0},ee=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},te=ee[N],ne=ee[I],re=de(0,B[_],$[_]),oe=O?B[_]/2-G-re-te-R.mainAxis:K-re-te-R.mainAxis,ie=O?-B[_]/2+G+re+ne+R.mainAxis:Q+re+ne+R.mainAxis,ae=t.elements.arrow&&E(t.elements.arrow),se=ae?"y"===j?ae.clientTop||0:ae.clientLeft||0:0,fe=null!=(q=null==S?void 0:S[j])?q:0,ce=F+ie-fe,pe=de(m?a(X,F+oe-fe-se):X,F,m?i(Y,ce):Y);k[j]=pe,V[j]=pe-F}if(c){var ue,le="x"===j?D:P,he="x"===j?A:L,me=k[M],ve="y"===M?"height":"width",ye=me+b[le],ge=me-b[he],be=-1!==[D,P].indexOf(x),xe=null!=(ue=null==S?void 0:S[M])?ue:0,we=be?ye:me-B[ve]-H[ve]-xe+R.altAxis,Oe=be?me+B[ve]+H[ve]-xe-R.altAxis:ge,je=m&&be?function(e,t,n){var r=de(e,t,n);return r>n?n:r}(we,me,Oe):de(m?we:ye,me,m?Oe:ge);k[M]=je,V[M]=je-me}t.modifiersData[r]=V}},requiresIfExists:["offset"]};var me={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=C(n.placement),f=z(s),c=[P,L].indexOf(s)>=0?"height":"width";if(i&&a){var p=function(e,t){return Y("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:G(e,k))}(o.padding,n),u=g(i),l="y"===f?D:P,d="y"===f?A:L,h=n.rects.reference[c]+n.rects.reference[f]-a[f]-n.rects.popper[c],m=a[f]-n.rects.reference[f],v=E(i),y=v?"y"===f?v.clientHeight||0:v.clientWidth||0:0,b=h/2-m/2,x=p[l],w=y-u[c]-p[d],O=y/2-u[c]/2+b,j=de(x,O,w),M=f;n.modifiersData[r]=((t={})[M]=j,t.centerOffset=j-O,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&N(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ve(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function ye(e){return[D,L,A,P].some((function(t){return e[t]>=0}))}var ge={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=J(t,{elementContext:"reference"}),s=J(t,{altBoundary:!0}),f=ve(a,r),c=ve(s,o,i),p=ye(f),u=ye(c);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}},be=Z({defaultModifiers:[ee,te,oe,ie]}),xe=[ee,te,oe,ie,ae,le,he,me,ge],we=Z({defaultModifiers:xe});e.applyStyles=ie,e.arrow=me,e.computeStyles=oe,e.createPopper=we,e.createPopperLite=be,e.defaultModifiers=xe,e.detectOverflow=J,e.eventListeners=ee,e.flip=le,e.hide=ge,e.offset=ae,e.popperGenerator=Z,e.popperOffsets=te,e.preventOverflow=he,Object.defineProperty(e,"__esModule",{value:!0})})); 6 | 7 | -------------------------------------------------------------------------------- /code/processing-code/processingfile-v1_files/libs/quarto-html/tippy.umd.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@popperjs/core")):"function"==typeof define&&define.amd?define(["@popperjs/core"],t):(e=e||self).tippy=t(e.Popper)}(this,(function(e){"use strict";var t={passive:!0,capture:!0},n=function(){return document.body};function r(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function o(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function i(e,t){return"function"==typeof e?e.apply(void 0,t):e}function a(e,t){return 0===t?e:function(r){clearTimeout(n),n=setTimeout((function(){e(r)}),t)};var n}function s(e,t){var n=Object.assign({},e);return t.forEach((function(e){delete n[e]})),n}function u(e){return[].concat(e)}function c(e,t){-1===e.indexOf(t)&&e.push(t)}function p(e){return e.split("-")[0]}function f(e){return[].slice.call(e)}function l(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})}function d(){return document.createElement("div")}function v(e){return["Element","Fragment"].some((function(t){return o(e,t)}))}function m(e){return o(e,"MouseEvent")}function g(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function h(e){return v(e)?[e]:function(e){return o(e,"NodeList")}(e)?f(e):Array.isArray(e)?e:f(document.querySelectorAll(e))}function b(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function y(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function w(e){var t,n=u(e)[0];return null!=n&&null!=(t=n.ownerDocument)&&t.body?n.ownerDocument:document}function E(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[r](t,n)}))}function O(e,t){for(var n=t;n;){var r;if(e.contains(n))return!0;n=null==n.getRootNode||null==(r=n.getRootNode())?void 0:r.host}return!1}var x={isTouch:!1},C=0;function T(){x.isTouch||(x.isTouch=!0,window.performance&&document.addEventListener("mousemove",A))}function A(){var e=performance.now();e-C<20&&(x.isTouch=!1,document.removeEventListener("mousemove",A)),C=e}function L(){var e=document.activeElement;if(g(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var D=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto,R=Object.assign({appendTo:n,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),k=Object.keys(R);function P(e){var t=(e.plugins||[]).reduce((function(t,n){var r,o=n.name,i=n.defaultValue;o&&(t[o]=void 0!==e[o]?e[o]:null!=(r=R[o])?r:i);return t}),{});return Object.assign({},e,t)}function j(e,t){var n=Object.assign({},t,{content:i(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(P(Object.assign({},R,{plugins:t}))):k).reduce((function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},R.aria,n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function M(e,t){e.innerHTML=t}function V(e){var t=d();return!0===e?t.className="tippy-arrow":(t.className="tippy-svg-arrow",v(e)?t.appendChild(e):M(t,e)),t}function I(e,t){v(t.content)?(M(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?M(e,t.content):e.textContent=t.content)}function S(e){var t=e.firstElementChild,n=f(t.children);return{box:t,content:n.find((function(e){return e.classList.contains("tippy-content")})),arrow:n.find((function(e){return e.classList.contains("tippy-arrow")||e.classList.contains("tippy-svg-arrow")})),backdrop:n.find((function(e){return e.classList.contains("tippy-backdrop")}))}}function N(e){var t=d(),n=d();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=d();function o(n,r){var o=S(t),i=o.box,a=o.content,s=o.arrow;r.theme?i.setAttribute("data-theme",r.theme):i.removeAttribute("data-theme"),"string"==typeof r.animation?i.setAttribute("data-animation",r.animation):i.removeAttribute("data-animation"),r.inertia?i.setAttribute("data-inertia",""):i.removeAttribute("data-inertia"),i.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?i.setAttribute("role",r.role):i.removeAttribute("role"),n.content===r.content&&n.allowHTML===r.allowHTML||I(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(i.removeChild(s),i.appendChild(V(r.arrow))):i.appendChild(V(r.arrow)):s&&i.removeChild(s)}return r.className="tippy-content",r.setAttribute("data-state","hidden"),I(r,e.props),t.appendChild(n),n.appendChild(r),o(e.props,e.props),{popper:t,onUpdate:o}}N.$$tippy=!0;var B=1,H=[],U=[];function _(o,s){var v,g,h,C,T,A,L,k,M=j(o,Object.assign({},R,P(l(s)))),V=!1,I=!1,N=!1,_=!1,F=[],W=a(we,M.interactiveDebounce),X=B++,Y=(k=M.plugins).filter((function(e,t){return k.indexOf(e)===t})),$={id:X,reference:o,popper:d(),popperInstance:null,props:M,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:Y,clearDelayTimeouts:function(){clearTimeout(v),clearTimeout(g),cancelAnimationFrame(h)},setProps:function(e){if($.state.isDestroyed)return;ae("onBeforeUpdate",[$,e]),be();var t=$.props,n=j(o,Object.assign({},t,l(e),{ignoreAttributes:!0}));$.props=n,he(),t.interactiveDebounce!==n.interactiveDebounce&&(ce(),W=a(we,n.interactiveDebounce));t.triggerTarget&&!n.triggerTarget?u(t.triggerTarget).forEach((function(e){e.removeAttribute("aria-expanded")})):n.triggerTarget&&o.removeAttribute("aria-expanded");ue(),ie(),J&&J(t,n);$.popperInstance&&(Ce(),Ae().forEach((function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})));ae("onAfterUpdate",[$,e])},setContent:function(e){$.setProps({content:e})},show:function(){var e=$.state.isVisible,t=$.state.isDestroyed,o=!$.state.isEnabled,a=x.isTouch&&!$.props.touch,s=r($.props.duration,0,R.duration);if(e||t||o||a)return;if(te().hasAttribute("disabled"))return;if(ae("onShow",[$],!1),!1===$.props.onShow($))return;$.state.isVisible=!0,ee()&&(z.style.visibility="visible");ie(),de(),$.state.isMounted||(z.style.transition="none");if(ee()){var u=re(),p=u.box,f=u.content;b([p,f],0)}A=function(){var e;if($.state.isVisible&&!_){if(_=!0,z.offsetHeight,z.style.transition=$.props.moveTransition,ee()&&$.props.animation){var t=re(),n=t.box,r=t.content;b([n,r],s),y([n,r],"visible")}se(),ue(),c(U,$),null==(e=$.popperInstance)||e.forceUpdate(),ae("onMount",[$]),$.props.animation&&ee()&&function(e,t){me(e,t)}(s,(function(){$.state.isShown=!0,ae("onShown",[$])}))}},function(){var e,t=$.props.appendTo,r=te();e=$.props.interactive&&t===n||"parent"===t?r.parentNode:i(t,[r]);e.contains(z)||e.appendChild(z);$.state.isMounted=!0,Ce()}()},hide:function(){var e=!$.state.isVisible,t=$.state.isDestroyed,n=!$.state.isEnabled,o=r($.props.duration,1,R.duration);if(e||t||n)return;if(ae("onHide",[$],!1),!1===$.props.onHide($))return;$.state.isVisible=!1,$.state.isShown=!1,_=!1,V=!1,ee()&&(z.style.visibility="hidden");if(ce(),ve(),ie(!0),ee()){var i=re(),a=i.box,s=i.content;$.props.animation&&(b([a,s],o),y([a,s],"hidden"))}se(),ue(),$.props.animation?ee()&&function(e,t){me(e,(function(){!$.state.isVisible&&z.parentNode&&z.parentNode.contains(z)&&t()}))}(o,$.unmount):$.unmount()},hideWithInteractivity:function(e){ne().addEventListener("mousemove",W),c(H,W),W(e)},enable:function(){$.state.isEnabled=!0},disable:function(){$.hide(),$.state.isEnabled=!1},unmount:function(){$.state.isVisible&&$.hide();if(!$.state.isMounted)return;Te(),Ae().forEach((function(e){e._tippy.unmount()})),z.parentNode&&z.parentNode.removeChild(z);U=U.filter((function(e){return e!==$})),$.state.isMounted=!1,ae("onHidden",[$])},destroy:function(){if($.state.isDestroyed)return;$.clearDelayTimeouts(),$.unmount(),be(),delete o._tippy,$.state.isDestroyed=!0,ae("onDestroy",[$])}};if(!M.render)return $;var q=M.render($),z=q.popper,J=q.onUpdate;z.setAttribute("data-tippy-root",""),z.id="tippy-"+$.id,$.popper=z,o._tippy=$,z._tippy=$;var G=Y.map((function(e){return e.fn($)})),K=o.hasAttribute("aria-expanded");return he(),ue(),ie(),ae("onCreate",[$]),M.showOnCreate&&Le(),z.addEventListener("mouseenter",(function(){$.props.interactive&&$.state.isVisible&&$.clearDelayTimeouts()})),z.addEventListener("mouseleave",(function(){$.props.interactive&&$.props.trigger.indexOf("mouseenter")>=0&&ne().addEventListener("mousemove",W)})),$;function Q(){var e=$.props.touch;return Array.isArray(e)?e:[e,0]}function Z(){return"hold"===Q()[0]}function ee(){var e;return!(null==(e=$.props.render)||!e.$$tippy)}function te(){return L||o}function ne(){var e=te().parentNode;return e?w(e):document}function re(){return S(z)}function oe(e){return $.state.isMounted&&!$.state.isVisible||x.isTouch||C&&"focus"===C.type?0:r($.props.delay,e?0:1,R.delay)}function ie(e){void 0===e&&(e=!1),z.style.pointerEvents=$.props.interactive&&!e?"":"none",z.style.zIndex=""+$.props.zIndex}function ae(e,t,n){var r;(void 0===n&&(n=!0),G.forEach((function(n){n[e]&&n[e].apply(n,t)})),n)&&(r=$.props)[e].apply(r,t)}function se(){var e=$.props.aria;if(e.content){var t="aria-"+e.content,n=z.id;u($.props.triggerTarget||o).forEach((function(e){var r=e.getAttribute(t);if($.state.isVisible)e.setAttribute(t,r?r+" "+n:n);else{var o=r&&r.replace(n,"").trim();o?e.setAttribute(t,o):e.removeAttribute(t)}}))}}function ue(){!K&&$.props.aria.expanded&&u($.props.triggerTarget||o).forEach((function(e){$.props.interactive?e.setAttribute("aria-expanded",$.state.isVisible&&e===te()?"true":"false"):e.removeAttribute("aria-expanded")}))}function ce(){ne().removeEventListener("mousemove",W),H=H.filter((function(e){return e!==W}))}function pe(e){if(!x.isTouch||!N&&"mousedown"!==e.type){var t=e.composedPath&&e.composedPath()[0]||e.target;if(!$.props.interactive||!O(z,t)){if(u($.props.triggerTarget||o).some((function(e){return O(e,t)}))){if(x.isTouch)return;if($.state.isVisible&&$.props.trigger.indexOf("click")>=0)return}else ae("onClickOutside",[$,e]);!0===$.props.hideOnClick&&($.clearDelayTimeouts(),$.hide(),I=!0,setTimeout((function(){I=!1})),$.state.isMounted||ve())}}}function fe(){N=!0}function le(){N=!1}function de(){var e=ne();e.addEventListener("mousedown",pe,!0),e.addEventListener("touchend",pe,t),e.addEventListener("touchstart",le,t),e.addEventListener("touchmove",fe,t)}function ve(){var e=ne();e.removeEventListener("mousedown",pe,!0),e.removeEventListener("touchend",pe,t),e.removeEventListener("touchstart",le,t),e.removeEventListener("touchmove",fe,t)}function me(e,t){var n=re().box;function r(e){e.target===n&&(E(n,"remove",r),t())}if(0===e)return t();E(n,"remove",T),E(n,"add",r),T=r}function ge(e,t,n){void 0===n&&(n=!1),u($.props.triggerTarget||o).forEach((function(r){r.addEventListener(e,t,n),F.push({node:r,eventType:e,handler:t,options:n})}))}function he(){var e;Z()&&(ge("touchstart",ye,{passive:!0}),ge("touchend",Ee,{passive:!0})),(e=$.props.trigger,e.split(/\s+/).filter(Boolean)).forEach((function(e){if("manual"!==e)switch(ge(e,ye),e){case"mouseenter":ge("mouseleave",Ee);break;case"focus":ge(D?"focusout":"blur",Oe);break;case"focusin":ge("focusout",Oe)}}))}function be(){F.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),F=[]}function ye(e){var t,n=!1;if($.state.isEnabled&&!xe(e)&&!I){var r="focus"===(null==(t=C)?void 0:t.type);C=e,L=e.currentTarget,ue(),!$.state.isVisible&&m(e)&&H.forEach((function(t){return t(e)})),"click"===e.type&&($.props.trigger.indexOf("mouseenter")<0||V)&&!1!==$.props.hideOnClick&&$.state.isVisible?n=!0:Le(e),"click"===e.type&&(V=!n),n&&!r&&De(e)}}function we(e){var t=e.target,n=te().contains(t)||z.contains(t);"mousemove"===e.type&&n||function(e,t){var n=t.clientX,r=t.clientY;return e.every((function(e){var t=e.popperRect,o=e.popperState,i=e.props.interactiveBorder,a=p(o.placement),s=o.modifiersData.offset;if(!s)return!0;var u="bottom"===a?s.top.y:0,c="top"===a?s.bottom.y:0,f="right"===a?s.left.x:0,l="left"===a?s.right.x:0,d=t.top-r+u>i,v=r-t.bottom-c>i,m=t.left-n+f>i,g=n-t.right-l>i;return d||v||m||g}))}(Ae().concat(z).map((function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:M}:null})).filter(Boolean),e)&&(ce(),De(e))}function Ee(e){xe(e)||$.props.trigger.indexOf("click")>=0&&V||($.props.interactive?$.hideWithInteractivity(e):De(e))}function Oe(e){$.props.trigger.indexOf("focusin")<0&&e.target!==te()||$.props.interactive&&e.relatedTarget&&z.contains(e.relatedTarget)||De(e)}function xe(e){return!!x.isTouch&&Z()!==e.type.indexOf("touch")>=0}function Ce(){Te();var t=$.props,n=t.popperOptions,r=t.placement,i=t.offset,a=t.getReferenceClientRect,s=t.moveTransition,u=ee()?S(z).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||te()}:o,p=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!s}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(ee()){var n=re().box;["placement","reference-hidden","escaped"].forEach((function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)})),t.attributes.popper={}}}}];ee()&&u&&p.push({name:"arrow",options:{element:u,padding:3}}),p.push.apply(p,(null==n?void 0:n.modifiers)||[]),$.popperInstance=e.createPopper(c,z,Object.assign({},n,{placement:r,onFirstUpdate:A,modifiers:p}))}function Te(){$.popperInstance&&($.popperInstance.destroy(),$.popperInstance=null)}function Ae(){return f(z.querySelectorAll("[data-tippy-root]"))}function Le(e){$.clearDelayTimeouts(),e&&ae("onTrigger",[$,e]),de();var t=oe(!0),n=Q(),r=n[0],o=n[1];x.isTouch&&"hold"===r&&o&&(t=o),t?v=setTimeout((function(){$.show()}),t):$.show()}function De(e){if($.clearDelayTimeouts(),ae("onUntrigger",[$,e]),$.state.isVisible){if(!($.props.trigger.indexOf("mouseenter")>=0&&$.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&V)){var t=oe(!1);t?g=setTimeout((function(){$.state.isVisible&&$.hide()}),t):h=requestAnimationFrame((function(){$.hide()}))}}else ve()}}function F(e,n){void 0===n&&(n={});var r=R.plugins.concat(n.plugins||[]);document.addEventListener("touchstart",T,t),window.addEventListener("blur",L);var o=Object.assign({},n,{plugins:r}),i=h(e).reduce((function(e,t){var n=t&&_(t,o);return n&&e.push(n),e}),[]);return v(e)?i[0]:i}F.defaultProps=R,F.setDefaultProps=function(e){Object.keys(e).forEach((function(t){R[t]=e[t]}))},F.currentInput=x;var W=Object.assign({},e.applyStyles,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),X={mouseover:"mouseenter",focusin:"focus",click:"click"};var Y={name:"animateFill",defaultValue:!1,fn:function(e){var t;if(null==(t=e.props.render)||!t.$$tippy)return{};var n=S(e.popper),r=n.box,o=n.content,i=e.props.animateFill?function(){var e=d();return e.className="tippy-backdrop",y([e],"hidden"),e}():null;return{onCreate:function(){i&&(r.insertBefore(i,r.firstElementChild),r.setAttribute("data-animatefill",""),r.style.overflow="hidden",e.setProps({arrow:!1,animation:"shift-away"}))},onMount:function(){if(i){var e=r.style.transitionDuration,t=Number(e.replace("ms",""));o.style.transitionDelay=Math.round(t/10)+"ms",i.style.transitionDuration=e,y([i],"visible")}},onShow:function(){i&&(i.style.transitionDuration="0ms")},onHide:function(){i&&y([i],"hidden")}}}};var $={clientX:0,clientY:0},q=[];function z(e){var t=e.clientX,n=e.clientY;$={clientX:t,clientY:n}}var J={name:"followCursor",defaultValue:!1,fn:function(e){var t=e.reference,n=w(e.props.triggerTarget||t),r=!1,o=!1,i=!0,a=e.props;function s(){return"initial"===e.props.followCursor&&e.state.isVisible}function u(){n.addEventListener("mousemove",f)}function c(){n.removeEventListener("mousemove",f)}function p(){r=!0,e.setProps({getReferenceClientRect:null}),r=!1}function f(n){var r=!n.target||t.contains(n.target),o=e.props.followCursor,i=n.clientX,a=n.clientY,s=t.getBoundingClientRect(),u=i-s.left,c=a-s.top;!r&&e.props.interactive||e.setProps({getReferenceClientRect:function(){var e=t.getBoundingClientRect(),n=i,r=a;"initial"===o&&(n=e.left+u,r=e.top+c);var s="horizontal"===o?e.top:r,p="vertical"===o?e.right:n,f="horizontal"===o?e.bottom:r,l="vertical"===o?e.left:n;return{width:p-l,height:f-s,top:s,right:p,bottom:f,left:l}}})}function l(){e.props.followCursor&&(q.push({instance:e,doc:n}),function(e){e.addEventListener("mousemove",z)}(n))}function d(){0===(q=q.filter((function(t){return t.instance!==e}))).filter((function(e){return e.doc===n})).length&&function(e){e.removeEventListener("mousemove",z)}(n)}return{onCreate:l,onDestroy:d,onBeforeUpdate:function(){a=e.props},onAfterUpdate:function(t,n){var i=n.followCursor;r||void 0!==i&&a.followCursor!==i&&(d(),i?(l(),!e.state.isMounted||o||s()||u()):(c(),p()))},onMount:function(){e.props.followCursor&&!o&&(i&&(f($),i=!1),s()||u())},onTrigger:function(e,t){m(t)&&($={clientX:t.clientX,clientY:t.clientY}),o="focus"===t.type},onHidden:function(){e.props.followCursor&&(p(),c(),i=!0)}}}};var G={name:"inlinePositioning",defaultValue:!1,fn:function(e){var t,n=e.reference;var r=-1,o=!1,i=[],a={name:"tippyInlinePositioning",enabled:!0,phase:"afterWrite",fn:function(o){var a=o.state;e.props.inlinePositioning&&(-1!==i.indexOf(a.placement)&&(i=[]),t!==a.placement&&-1===i.indexOf(a.placement)&&(i.push(a.placement),e.setProps({getReferenceClientRect:function(){return function(e){return function(e,t,n,r){if(n.length<2||null===e)return t;if(2===n.length&&r>=0&&n[0].left>n[1].right)return n[r]||t;switch(e){case"top":case"bottom":var o=n[0],i=n[n.length-1],a="top"===e,s=o.top,u=i.bottom,c=a?o.left:i.left,p=a?o.right:i.right;return{top:s,bottom:u,left:c,right:p,width:p-c,height:u-s};case"left":case"right":var f=Math.min.apply(Math,n.map((function(e){return e.left}))),l=Math.max.apply(Math,n.map((function(e){return e.right}))),d=n.filter((function(t){return"left"===e?t.left===f:t.right===l})),v=d[0].top,m=d[d.length-1].bottom;return{top:v,bottom:m,left:f,right:l,width:l-f,height:m-v};default:return t}}(p(e),n.getBoundingClientRect(),f(n.getClientRects()),r)}(a.placement)}})),t=a.placement)}};function s(){var t;o||(t=function(e,t){var n;return{popperOptions:Object.assign({},e.popperOptions,{modifiers:[].concat(((null==(n=e.popperOptions)?void 0:n.modifiers)||[]).filter((function(e){return e.name!==t.name})),[t])})}}(e.props,a),o=!0,e.setProps(t),o=!1)}return{onCreate:s,onAfterUpdate:s,onTrigger:function(t,n){if(m(n)){var o=f(e.reference.getClientRects()),i=o.find((function(e){return e.left-2<=n.clientX&&e.right+2>=n.clientX&&e.top-2<=n.clientY&&e.bottom+2>=n.clientY})),a=o.indexOf(i);r=a>-1?a:r}},onHidden:function(){r=-1}}}};var K={name:"sticky",defaultValue:!1,fn:function(e){var t=e.reference,n=e.popper;function r(t){return!0===e.props.sticky||e.props.sticky===t}var o=null,i=null;function a(){var s=r("reference")?(e.popperInstance?e.popperInstance.state.elements.reference:t).getBoundingClientRect():null,u=r("popper")?n.getBoundingClientRect():null;(s&&Q(o,s)||u&&Q(i,u))&&e.popperInstance&&e.popperInstance.update(),o=s,i=u,e.state.isMounted&&requestAnimationFrame(a)}return{onMount:function(){e.props.sticky&&a()}}}};function Q(e,t){return!e||!t||(e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom||e.left!==t.left)}return F.setDefaultProps({plugins:[Y,J,G,K],render:N}),F.createSingleton=function(e,t){var n;void 0===t&&(t={});var r,o=e,i=[],a=[],c=t.overrides,p=[],f=!1;function l(){a=o.map((function(e){return u(e.props.triggerTarget||e.reference)})).reduce((function(e,t){return e.concat(t)}),[])}function v(){i=o.map((function(e){return e.reference}))}function m(e){o.forEach((function(t){e?t.enable():t.disable()}))}function g(e){return o.map((function(t){var n=t.setProps;return t.setProps=function(o){n(o),t.reference===r&&e.setProps(o)},function(){t.setProps=n}}))}function h(e,t){var n=a.indexOf(t);if(t!==r){r=t;var s=(c||[]).concat("content").reduce((function(e,t){return e[t]=o[n].props[t],e}),{});e.setProps(Object.assign({},s,{getReferenceClientRect:"function"==typeof s.getReferenceClientRect?s.getReferenceClientRect:function(){var e;return null==(e=i[n])?void 0:e.getBoundingClientRect()}}))}}m(!1),v(),l();var b={fn:function(){return{onDestroy:function(){m(!0)},onHidden:function(){r=null},onClickOutside:function(e){e.props.showOnCreate&&!f&&(f=!0,r=null)},onShow:function(e){e.props.showOnCreate&&!f&&(f=!0,h(e,i[0]))},onTrigger:function(e,t){h(e,t.currentTarget)}}}},y=F(d(),Object.assign({},s(t,["overrides"]),{plugins:[b].concat(t.plugins||[]),triggerTarget:a,popperOptions:Object.assign({},t.popperOptions,{modifiers:[].concat((null==(n=t.popperOptions)?void 0:n.modifiers)||[],[W])})})),w=y.show;y.show=function(e){if(w(),!r&&null==e)return h(y,i[0]);if(!r||null!=e){if("number"==typeof e)return i[e]&&h(y,i[e]);if(o.indexOf(e)>=0){var t=e.reference;return h(y,t)}return i.indexOf(e)>=0?h(y,e):void 0}},y.showNext=function(){var e=i[0];if(!r)return y.show(0);var t=i.indexOf(r);y.show(i[t+1]||e)},y.showPrevious=function(){var e=i[i.length-1];if(!r)return y.show(e);var t=i.indexOf(r),n=i[t-1]||e;y.show(n)};var E=y.setProps;return y.setProps=function(e){c=e.overrides||c,E(e)},y.setInstances=function(e){m(!0),p.forEach((function(e){return e()})),o=e,m(!1),v(),l(),p=g(y),y.setProps({triggerTarget:a})},p=g(y),y},F.delegate=function(e,n){var r=[],o=[],i=!1,a=n.target,c=s(n,["target"]),p=Object.assign({},c,{trigger:"manual",touch:!1}),f=Object.assign({touch:R.touch},c,{showOnCreate:!0}),l=F(e,p);function d(e){if(e.target&&!i){var t=e.target.closest(a);if(t){var r=t.getAttribute("data-tippy-trigger")||n.trigger||R.trigger;if(!t._tippy&&!("touchstart"===e.type&&"boolean"==typeof f.touch||"touchstart"!==e.type&&r.indexOf(X[e.type])<0)){var s=F(t,f);s&&(o=o.concat(s))}}}}function v(e,t,n,o){void 0===o&&(o=!1),e.addEventListener(t,n,o),r.push({node:e,eventType:t,handler:n,options:o})}return u(l).forEach((function(e){var n=e.destroy,a=e.enable,s=e.disable;e.destroy=function(e){void 0===e&&(e=!0),e&&o.forEach((function(e){e.destroy()})),o=[],r.forEach((function(e){var t=e.node,n=e.eventType,r=e.handler,o=e.options;t.removeEventListener(n,r,o)})),r=[],n()},e.enable=function(){a(),o.forEach((function(e){return e.enable()})),i=!1},e.disable=function(){s(),o.forEach((function(e){return e.disable()})),i=!0},function(e){var n=e.reference;v(n,"touchstart",d,t),v(n,"mouseover",d),v(n,"focusin",d),v(n,"click",d)}(e)})),l},F.hideAll=function(e){var t=void 0===e?{}:e,n=t.exclude,r=t.duration;U.forEach((function(e){var t=!1;if(n&&(t=g(n)?e.reference===n:e.popper===n.popper),!t){var o=e.props.duration;e.setProps({duration:r}),e.hide(),e.state.isDestroyed||e.setProps({duration:o})}}))},F.roundArrow='',F})); 2 | 3 | --------------------------------------------------------------------------------