├── .gitignore ├── CITATION.cff ├── README.md ├── _config.yml ├── _targets.R ├── create-project.sh ├── exercises ├── 2_rmarkdown_question.html ├── 2_rmarkdown_solution.html ├── 3_papaja_example_manuscript │ ├── analyses.R │ ├── appendix.Rmd │ ├── data │ │ ├── acquisition-task.rds │ │ └── generation-task.rds │ ├── manuscript.Rmd │ ├── manuscript.docx │ ├── manuscript.pdf │ └── references.bib ├── 3_papaja_question.html ├── 3_papaja_solution.html ├── 3_papaja_table_example │ ├── apa_table_example.Rmd │ └── apa_table_example.bib ├── 4_git_github_question.html ├── 4_git_github_solution.html ├── 5_git-rstudio_question.html ├── 5_git-rstudio_solution.html ├── 6_github_collaboration_question.html ├── 6_github_collaboration_solution.html ├── 7_docker_example │ └── Dockerfile ├── gapminder_example.Rmd └── gapminder_example.html ├── make.sh ├── outline.html ├── outline.md ├── reproducible-research-practices-workshop.Rproj ├── slides ├── 1_introduction.html ├── 1_introduction.pdf ├── 2_Intro_RMarkdown.html ├── 2_Intro_RMarkdown.pdf ├── 3_papaja.html ├── 3_papaja.pdf ├── 4_git_github.html ├── 4_git_github.pdf ├── 5_Git-RStudio.html ├── 5_Git-RStudio.pdf ├── 6_github_collaboration.html ├── 6_github_collaboration.pdf ├── 7_Other_Topics.html └── 7_Other_Topics.pdf └── src ├── exercises ├── 2_rmarkdown.Rmd ├── 3_papaja.Rmd ├── 4_git_github.Rmd ├── 5_git&rstudio.Rmd ├── 6_github_collaboration.Rmd ├── _output.yaml ├── _setup.Rmd └── template.Rmd ├── outline.Rmd └── slides ├── 1_introduction.Rmd ├── 2_Intro_RMarkdown.Rmd ├── 3_papaja.Rmd ├── 4_git_github.Rmd ├── 5_Git&RStudio.Rmd ├── 6_github_collaboration.Rmd ├── 7_Other_Topics.Rmd ├── _output.yaml ├── _setup.Rmd ├── cosmetic_surgery.Rdata ├── img ├── Rlogo.png ├── binderhub.png ├── checkpoint-pkg.png ├── choose_git.png ├── chunk_buttons.png ├── code_chunk.png ├── code_chunk_options.png ├── codeocean.png ├── compilation_process.png ├── container-stack.png ├── create_rmarkdown_menu.png ├── dependendy-graph.png ├── docker-logo.png ├── git-branching.jpg ├── git-fire.png ├── git-history.png ├── git-status.png ├── git-system.png ├── git_clone_https.png ├── git_clone_ssh.png ├── git_commit.png ├── git_menu.png ├── git_menu_rstudio.png ├── git_pane_files_changed.png ├── git_staged.png ├── github-add-collaborator.png ├── github-clone.png ├── github-commit.png ├── github-edit-pr.png ├── github-edit.png ├── github-home.png ├── github-inline-comment.png ├── github-logo.png ├── github-merge-conflict-edit.png ├── github-merge-conflict-resolve.png ├── github-merge-conflict.png ├── github-new-repo.png ├── github-open-pr.png ├── github-pr-branch.png ├── github-pr-branch2.png ├── github-pr-review.png ├── github-workflow.png ├── gitignore.png ├── gitlab-add-collaborator.png ├── gitlab-home.png ├── gitlab-logo.png ├── gitlab-new-repo.png ├── gl_ssh.png ├── hands.png ├── hermann-docker.png ├── hermann.png ├── inline_code.png ├── papaja-docker-repo.png ├── papaja_hex.png ├── papaja_skeleton.png ├── replication-typology-a.jpg ├── reproducibility-schema-1.png ├── reproducibility_court.png ├── reproducible-matrix.jpg ├── result_formatting_process.png ├── rmarkdown_example.png ├── rmarkdown_example_annotated.png ├── rmarkdown_formats.png ├── rmarkdown_preview.png ├── rmarkdown_process.png ├── rmarkdown_rockstar.png ├── rmarkdown_wizards.png ├── rocker-images.png ├── rstudio-branches.png ├── rstudio-git-commit.png ├── rstudio-git-history.png ├── rstudio-git-pushed.png ├── rstudio-git-untracked.png ├── rstudio-new-git.png ├── rstudio_open_visual_rmd.png ├── rstudio_visual_rmd.png ├── setup_chunk.png ├── srt-thin.gif ├── ssh_key_gitlab.png ├── standard-finding.png ├── terminal.png ├── terminal_menu.png ├── toppling-tower.jpg ├── trr-cube.jpg ├── turing_way_parts.jpg ├── vc_project.png └── vm-stack.png ├── libs ├── clipboard │ └── clipboard.min.js ├── header-attrs │ └── header-attrs.js ├── remark-latest.min.js ├── tile-view │ ├── tile-view.css │ └── tile-view.js └── xaringanExtra-clipboard │ ├── xaringanExtra-clipboard.css │ └── xaringanExtra-clipboard.js ├── src ├── medium-zoom.js ├── slides.css └── xaringan-themer.css └── template.Rmd /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # User-specific files 9 | .Ruserdata 10 | 11 | # Example code in package build process 12 | *-Ex.R 13 | 14 | # Output files from R CMD build 15 | /*.tar.gz 16 | 17 | # Output files from R CMD check 18 | /*.Rcheck/ 19 | 20 | # RStudio files 21 | .Rproj.user/ 22 | 23 | # produced vignettes 24 | vignettes/*.html 25 | vignettes/*.pdf 26 | 27 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 28 | .httr-oauth 29 | 30 | # knitr and R markdown default cache directories 31 | *_cache/ 32 | /cache/ 33 | 34 | # Temporary files created by R markdown 35 | *.utf8.md 36 | *.knit.md 37 | 38 | # R Environment Variables 39 | .Renviron 40 | 41 | # Operating system 42 | .DS_Store 43 | 44 | _targets 45 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use these materials, please cite them as follows." 3 | authors: 4 | - family-names: "Aust" 5 | given-names: "Frederik" 6 | orcid: "https://orcid.org/0000-0003-4900-788X" 7 | - family-names: "Breuer" 8 | given-names: "Johannes" 9 | orcid: "https://orcid.org/0000-0001-5906-7873" 10 | title: "Workshop on reproducible research practices for psychologists" 11 | date-released: 2022-04-27 12 | url: "https://github.com/crsh/reproducible-research-practices-workshop" 13 | license: CC-BY-4.0 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Workshop "Reproducible research practices for psychologists" 2 | 3 | [Johannes Breuer](https://www.johannesbreuer.com/) & [Frederik Aust](http://frederikaust.com/) 4 | 5 | ## Workshop description 6 | 7 | For several years, psychological science has been facing a crisis of confidence fueled by concerns about low rates of successful replications of empirical findings. 8 | Different solutions have been proposed to address this issue. 9 | A key factor in these efforts is increasing transparency and computational reproducibility of psychological research. 10 | While transparent and computationally reproducible research is not necessarily more replicable, it facilitates replication attempts and helps to foster trust in empirical findings. 11 | The evolving open science ecosystem provides a variety of tools and services that can be used to implement reproducible research practices. 12 | Navigating the growing space of tools and practices, however, can be a daunting task. 13 | 14 | Hence, the purpose of this 2 days workshop is to introduce researchers to the essential components of tailored reproducible research workflows as well as the tools for implementing them. 15 | Combining lectures with practical hands-on sessions, the workshop will focus on data analysis, reporting of results, and sharing data and materials. 16 | Regarding the tool stack, the workshop will cover version control with `Git` and writing reports with `R Markdown` as key components of a reproducible research workflow, but will also introduce other tools, such as `Docker`, and `Binder`. 17 | 18 | 19 | ## Learning objectives 20 | 21 | Upon course completion, participants should 22 | 23 | 1. be familiar with key concepts of reproducible research 24 | 2. be able to choose the appropriate tools to implement a tailored workflow 25 | 3. have gained basic proficiency of `Git`, `R Markdown`, and `papaja` 26 | 4. be able to manage projects and collaborate using `Git` and *GitHub* 27 | 28 | 29 | ## Prerequisites 30 | 31 | Participants should have some basic knowledge of `R` and some experience with *RStudio*. 32 | 33 | For the hands-on parts of the workshop, you need to install [`R`](https://www.r-project.org/) (version 4.0.0 or higher), [`Git`](https://git-scm.com/), [*RStudio*](https://www.rstudio.com/products/rstudio/download/), and the `R` packages [`tinytex`](https://yihui.org/tinytex/) and [`papaja`](https://github.com/crsh/papaja). 34 | 35 | You should also set up a [*GitHub*](https://github.com/) account or an account for the *GitLab* instance hosted by your institution (if that is available and you you want to use it). To set up `Git` and *GitHub* for use with *RStudio*, refer to [*Happy Git and GitHub for the useR*](https://happygitwithr.com/). 36 | 37 | 38 | ## Modules 39 | 40 | | Day | Topic | Duration | Slides | Exercises | Solutions | 41 | | ---: | :---- | ------: | :----: | :-------: | :-------: | 42 | | 1 | Introduction | ~ 2 hrs | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/1_introduction.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/1_introduction.pdf) | - | - | 43 | | 1 | R Markdown | ~ 2 hrs | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/2_Intro_RMarkdown.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/2_Intro_RMarkdown.pdf) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/2_rmarkdown_question.html) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/2_rmarkdown_solution.html) | 44 | | 1 | papaja | ~ 1.5 hrs | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/3_papaja.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/3_papaja.pdf) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/3_papaja_question.html) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/3_papaja_solution.html) | 45 | | 2 | Git & GitHub | ~ 1 hr | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/4_git_github.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/4_git_github.pdf) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/4_git_github_question.html) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/4_git_github_solution.html) | 46 | | 2 | Git & RStudio | ~ 1 hr | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/5_Git-RStudio.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/5_Git-RStudio.pdf) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/5_git-rstudio_question.html) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/5_git-rstudio_solution.html) | 47 | | 2 | Collaborate with Git & GitHub | ~ 1.5 hrs | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/6_github_collaboration.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/6_git_collaboration.pdf) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/6_github_collaboration_question.html) | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/exercises/6_github_collaboration_solution.html) | 48 | | 2 | Other topics in reproducible research | ~ 1.5 hrs | [HTML](https://crsh.github.io/reproducible-research-practices-workshop/slides/7_Other_Topics.html), [PDF](https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/main/slides/7_Other_Topics.pdf) | - | - | 49 | 50 | 51 | ## Citation 52 | 53 | If you use these materials, please cite them as follows. 54 | 55 | > Aust, F., & Breuer, J. (2022). Workshop on reproducible research practices for psychologists. https://github.com/crsh/reproducible-research-practices-workshop 56 | 57 | ## Acknowledgements 58 | 59 | The workflow recommendations in this workshop are based on Klein, O., Hardwicke, T. E., Aust, F., Breuer, J., Danielsson, H., Hofelich Mohr, A., … Frank, M. C. (2018). A Practical Guide for Transparency in Psychological Science. Collabra: Psychology, 4(1). doi: [10.1525/collabra.158](https://doi.org/10.1525/collabra.158) ([Supplementary material]( 60 | http://psych-transparency-guide.uni-koeln.de/)) 61 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /_targets.R: -------------------------------------------------------------------------------- 1 | library("targets") 2 | library("tarchetypes") 3 | 4 | options(tidyverse.quiet = TRUE) 5 | 6 | tar_option_set(packages = c("rprojroot", "tools", "rmarkdown", "fs")) 7 | 8 | slides_dir <- "src/slides" 9 | exercise_dir <- "src/exercises" 10 | 11 | 12 | exercise_rmd <- list.files( 13 | path = exercise_dir 14 | , pattern = "\\.rmd$|\\.Rmd$" 15 | , full.names = TRUE 16 | ) 17 | exercise_rmd <- exercise_rmd[!grepl("template|setup", exercise_rmd)] 18 | 19 | slide_rmd <- list.files( 20 | path = slides_dir 21 | , pattern = "\\.rmd$|\\.Rmd$" 22 | , full.names = TRUE 23 | ) 24 | slide_rmd <- slide_rmd[!grepl("template|setup", slide_rmd)] 25 | 26 | 27 | list( 28 | # Workshop metadata 29 | tar_target( 30 | workshop_meta 31 | , list( 32 | author = c("Johannes Breuer", "Frederik Aust") 33 | , date = "27.-28.04.2022" 34 | , location = "KU Leuven" 35 | ) 36 | ), 37 | 38 | # Source files 39 | ## Slides 40 | tar_target( 41 | slide_rmd_files 42 | , c(!!slide_rmd) 43 | , format = "file" 44 | ), 45 | tar_target( 46 | slide_rmds 47 | , slide_rmd_files 48 | ), 49 | tar_target( 50 | slide_styles 51 | , c("src/slides/src/xaringan-themer.css", "src/slides/src/slides.css") 52 | , format = "file" 53 | ), 54 | tar_target( 55 | slide_output_file 56 | , c( 57 | file.path(!!slides_dir, "_output.yaml") 58 | , file.path(!!slides_dir, "_setup.Rmd") 59 | ) 60 | , format = "file" 61 | ), 62 | 63 | ## Exercises 64 | tar_target( 65 | exercise_rmd_files 66 | , c(!!exercise_rmd) 67 | , format = "file" 68 | ), 69 | tar_target( 70 | exercise_rmds 71 | , exercise_rmd_files 72 | ), 73 | tar_target( 74 | exercise_output_file 75 | , c( 76 | file.path(!!exercise_dir, "_output.yaml") 77 | , file.path(!!exercise_dir, "_setup.Rmd") 78 | ) 79 | , format = "file" 80 | ), 81 | 82 | # Render R Markdown files 83 | ## Outline 84 | tar_target( 85 | render_outline 86 | , { 87 | params <- workshop_meta 88 | 89 | fs::path_rel( 90 | # Need to return/track all input/output files. 91 | c( 92 | rmarkdown::render( 93 | input = "src/outline.Rmd" 94 | , output_dir = "." 95 | , intermediates_dir = file.path(rprojroot::find_rstudio_root_file(), "src") 96 | , knit_root_dir = file.path(rprojroot::find_rstudio_root_file(), "src") 97 | , clean = TRUE 98 | , params = workshop_meta 99 | , output_options = list(self_contained = TRUE) 100 | ) 101 | , "src/outline.Rmd" 102 | ) 103 | ) 104 | } 105 | , format = "file" 106 | ), 107 | 108 | ## Slides 109 | tar_target( 110 | render_slides 111 | , { 112 | params <- workshop_meta 113 | list(slide_styles) 114 | list(slide_output_file) 115 | 116 | fs::path_rel( 117 | # Need to return/track all input/output files. 118 | c( 119 | rmarkdown::render( 120 | input = slide_rmds 121 | , output_dir = "slides" 122 | , intermediates_dir = file.path(rprojroot::find_rstudio_root_file(), !!slides_dir) 123 | , knit_root_dir = file.path(rprojroot::find_rstudio_root_file(), !!slides_dir) 124 | , clean = TRUE 125 | , params = workshop_meta 126 | , output_yaml = slide_output_file 127 | , output_options = list(self_contained = TRUE) 128 | ) 129 | , slide_rmds 130 | ) 131 | ) 132 | } 133 | , pattern = map(slide_rmds) 134 | , format = "file" 135 | ), 136 | 137 | ## Exercises 138 | tar_target( 139 | render_exercises 140 | , { 141 | params <- workshop_meta 142 | list(exercise_output_file) 143 | 144 | fs::path_rel( 145 | # Need to return/track all input/output files. 146 | c( 147 | rmarkdown::render( 148 | input = exercise_rmds 149 | , output_format = "all" 150 | , output_dir = "exercises" 151 | , intermediates_dir = file.path(rprojroot::find_rstudio_root_file(), !!exercise_dir) 152 | , knit_root_dir = file.path(rprojroot::find_rstudio_root_file(), !!exercise_dir) 153 | , clean = TRUE 154 | , params = workshop_meta 155 | , output_yaml = exercise_output_file 156 | ) 157 | , exercise_rmds 158 | ) 159 | ) 160 | } 161 | , pattern = map(exercise_rmds) 162 | , format = "file" 163 | ), 164 | 165 | # Spell checking 166 | tar_target( 167 | spellcheck_exceptions 168 | # Add new exceptions here 169 | , c("pandoc", "Frederik", "Aust", "Johannes", "Breuer") 170 | ), 171 | tar_target( 172 | spellcheck_rmds 173 | , spelling::spell_check_files( 174 | c(slide_rmds, exercise_rmd) 175 | , ignore = spellcheck_exceptions 176 | ) 177 | ), 178 | tar_force( 179 | spellcheck_report_results 180 | , print(spellcheck_rmds) 181 | , nrow(spellcheck_rmds) > 0 182 | ) 183 | ) 184 | -------------------------------------------------------------------------------- /create-project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# -eq 0 ] 4 | then 5 | echo "Please provide a valid path for the project." 6 | exit 1 7 | fi 8 | 9 | mkdir $1 10 | cd $1 11 | mkdir data 12 | mkdir src 13 | mkdir output 14 | touch .gitignore 15 | touch README 16 | -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/analyses.R: -------------------------------------------------------------------------------- 1 | ## ----setup--------------------------------------------------------------- 2 | # load packages 3 | library("papaja") 4 | library("afex") 5 | library("emmeans") 6 | 7 | 8 | ## ----global-par---------------------------------------------------------- 9 | # Define a function that sets desired global plot defaults 10 | par(font.main = 1, las = 1) 11 | 12 | 13 | ## ----prepare-data-------------------------------------------------------- 14 | acquisition <- readRDS("data/acquisition-task.rds") 15 | generation <- readRDS("data/generation-task.rds") 16 | 17 | # set some variable labels for pretty plotting 18 | variable_labels(acquisition) <- c( 19 | age = "Age" 20 | , sex = "Sex" 21 | , material = "Material" 22 | , generation = "Generation task" 23 | , order = "Block order" 24 | , block = "Block number" 25 | , trial = "Trial number" 26 | , S = "Stimulus location" 27 | , R = "Response location" 28 | , SRI = "Response time [ms]" 29 | , error = "Error" 30 | , frequency = "Location frequency" 31 | ) 32 | 33 | variable_labels(generation) <- c( 34 | age = "Age" 35 | , sex = "Sex" 36 | , material = "Material" 37 | , generation = "Generation task" 38 | , order = "Block order" 39 | , block = "Block number" 40 | , trial = "Trial number" 41 | , PD_instruction = "PD instruction" 42 | , correct_SOC = "Correctly generated second-order conditional" 43 | ) 44 | 45 | 46 | ## ----participants-------------------------------------------------------- 47 | # stats for participants section 48 | excluded_participants <- unique(c(55, 74, 75, 126, 5, 7, 9, 12, 15)) 49 | 50 | N <- length(unique(generation$id)) 51 | 52 | n.excluded_participants <- length(excluded_participants) 53 | 54 | tmp <- aggregate(formula = correct_SOC ~ id + sex + age, data = generation, FUN=mean) 55 | Sex <- table(tmp$sex) 56 | 57 | # Age: mean and range 58 | mean(tmp$age) 59 | range(tmp$age) 60 | 61 | 62 | ## ----acquisition-rt------------------------------------------------------ 63 | # Reaction times during SRTT phase (i.e., training or acquisition) 64 | tmp <- acquisition[ 65 | acquisition$error == 0 & 66 | acquisition$material != "No-learning" & # these Ss didn't work on SRTT 67 | acquisition$trial > 1 & 68 | acquisition$included_participant, 69 | ] 70 | 71 | par(mfrow = c(1, 2)) # place two different plots side-by-side 72 | 73 | # left panel: RTs in permuted and random material groups 74 | apa_lineplot( 75 | data = tmp 76 | , id = "id" 77 | , dv = "SRI" 78 | , factors = c("block", "material") 79 | , dispersion = wsci 80 | , ylab = "Mean RT [ms]" 81 | , args_lines = list(lty = c("solid", "dotted")) 82 | , args_points = list(pch = c(21, 23), bg = c("grey70", "white")) 83 | , args_legend = list(legend = c("Permuted", "Random")) 84 | , ylim = c(475, 650) 85 | , jit = .05 86 | ) 87 | 88 | # within the permuted-material group, high vs. low frequency locations can be distinguished 89 | tmp.perm <- acquisition[ 90 | acquisition$error == 0 & 91 | acquisition$trial > 1 & 92 | acquisition$included_participant & 93 | acquisition$material == "Permuted" & 94 | !is.na(acquisition$frequency), 95 | ] 96 | 97 | 98 | aov_ez(data = tmp.perm, dv = "SRI", within = c("block", "frequency"), id = "id") 99 | 100 | apa_lineplot( 101 | data = tmp.perm 102 | , id = "id" 103 | , dv = "SRI" 104 | , factors = c("block", "frequency") 105 | , dispersion = wsci 106 | , ylab = "" 107 | , args_lines = list(lty = c("solid", "solid")) 108 | , args_points = list(pch = c(21, 21)) 109 | , args_legend = list(legend = c("High", "Low"), title = "Location frequency") 110 | , ylim = c(475, 650) 111 | , jit = .05 112 | ) 113 | 114 | 115 | aov_ez(data = tmp, dv = "SRI", id = "id", between = "material", within = "block") 116 | 117 | 118 | 119 | ## ----generation-soc------------------------------------------------------ 120 | # proportion of correctly generated triplets in the generation task 121 | # excluding repetitions and trials after repetitions 122 | 123 | tmp <- generation[ 124 | generation$included_participant & 125 | generation$trial > 2 & 126 | generation$repetition == 0 & 127 | generation$post_repetition == 0, 128 | ] 129 | 130 | # visualize 131 | apa_barplot( 132 | data = tmp 133 | , id = "id" 134 | , dv = "correct_SOC" 135 | , ylab = "Proportion correct generation" 136 | , factors = c("material","PD_instruction", "generation") 137 | , ylim = c(0, 1) 138 | , main = c("Free generation", "Cued generation") 139 | , intercept = .2 140 | ) 141 | 142 | 143 | # ANOVA for complete design 144 | aov_ez(data = tmp, id = "id", dv = "correct_SOC", between = c("material", "generation", "order"), within = "PD_instruction") 145 | 146 | # separate analysis for free-generation task 147 | tmp.a <- tmp[tmp$generation == "Free", ] 148 | fit <- aov_ez(data = tmp.a, id = "id", dv = "correct_SOC", between = c("material", "order"), within = "PD_instruction") 149 | fit 150 | 151 | # Post-hoc paired comparisons for free-generation group 152 | pairs(emmeans(fit, specs = "material"), adjust = "tukey") 153 | 154 | 155 | #----proportion-correct-table-appendix------------------------------ 156 | tmp <- generation[ 157 | generation$included_participant & 158 | generation$repetition == 0 & 159 | generation$post_repetition == 0, 160 | ] 161 | 162 | # calculate proportion of regular transitions per participant 163 | agg <- aggregate(formula = correct_SOC ~ material + generation + order + PD_instruction + id, data = tmp, FUN = mean, na.rm = TRUE) 164 | 165 | # calculate condition means and standard errors 166 | means <- aggregate(formula = cbind(M = correct_SOC) ~ material + generation + order + PD_instruction, data = agg, FUN = mean) 167 | SEs <- aggregate(formula = cbind(`SE` = correct_SOC) ~ material + generation + order + PD_instruction, data = agg, FUN = se) 168 | 169 | # merge means and CI width 170 | tab <- merge(means, SEs) 171 | 172 | # bind Inclusion and Exclusion side-by-side 173 | tab <- cbind(tab[tab$PD_instruction == "Inclusion", ], tab[tab$PD_instruction == "Exclusion", c("M", "SE")]) 174 | tab$PD_instruction <- NULL 175 | 176 | tab$material <- gsub(tab$material, pattern = "-", replacement = " ", fixed = TRUE) 177 | tab$generation <- as.character(tab$generation) 178 | tab$generation[duplicated(paste0(tab$material, tab$generation))] <- "" 179 | tab$material[duplicated(tab$material)] <- "" 180 | tab 181 | -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/appendix.Rmd: -------------------------------------------------------------------------------- 1 | 2 | # Additional Descriptives 3 | 4 | (ref:table-caption) Means ($M$) and standard errors ($\mathit{SE}$) of proportion of correctly generated second-order conditionals (SOCs). 5 | 6 | 7 | ```{r} 8 | tmp <- generation[ 9 | generation$included_participant & 10 | generation$repetition == 0 & 11 | generation$post_repetition == 0 12 | , 13 | ] 14 | 15 | # calculate proportion of regular transitions per participant 16 | agg <- aggregate(formula = correct_SOC ~ material + generation + order + PD_instruction + id, data = tmp, FUN = mean, na.rm = TRUE) 17 | 18 | # calculate condition means and standard errors 19 | means <- aggregate(formula = cbind(M = correct_SOC) ~ material + generation + order + PD_instruction, data = agg, FUN = mean) 20 | SEs <- aggregate(formula = cbind(`SE` = correct_SOC) ~ material + generation + order + PD_instruction, data = agg, FUN = se) 21 | 22 | # merge means and CI width 23 | tab <- merge(means, SEs) 24 | 25 | # bind Inclusion and Exclusion side-by-side 26 | tab <- cbind(tab[tab$PD_instruction == "Inclusion", ], tab[tab$PD_instruction == "Exclusion", c("M", "SE")]) 27 | tab$PD_instruction <- NULL 28 | 29 | tab$material <- gsub(tab$material, pattern = "-", replacement = " ", fixed = TRUE) 30 | tab$generation <- as.character(tab$generation) 31 | tab$generation[duplicated(paste0(tab$material, tab$generation))] <- "" 32 | tab$material[duplicated(tab$material)] <- "" 33 | 34 | 35 | variable_labels(tab) <- c( 36 | material = "Material" 37 | , generation = "Generation task" 38 | , order = "Order" 39 | , M = "$M$" 40 | , SE = "$\\mathit{SE}$" 41 | ) 42 | 43 | apa_table( 44 | tab 45 | , row.names = FALSE 46 | , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7)) 47 | , caption = "(ref:table-caption)" 48 | , midrules = seq(4, 12, 4) 49 | , format.args = list(gt1 = FALSE) # suppress leading zeros 50 | , placement = NULL 51 | ) 52 | ``` 53 | -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/data/acquisition-task.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/exercises/3_papaja_example_manuscript/data/acquisition-task.rds -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/data/generation-task.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/exercises/3_papaja_example_manuscript/data/generation-task.rds -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/manuscript.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/exercises/3_papaja_example_manuscript/manuscript.docx -------------------------------------------------------------------------------- /exercises/3_papaja_example_manuscript/manuscript.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/exercises/3_papaja_example_manuscript/manuscript.pdf -------------------------------------------------------------------------------- /exercises/3_papaja_table_example/apa_table_example.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "papaja: Table examples" 3 | shorttitle : "Table examples" 4 | 5 | author: 6 | - name : "Frederik Aust" 7 | affiliation : "" 8 | corresponding : yes # Define only one corresponding author 9 | address : "Postal address" 10 | email : "my@email.com" 11 | 12 | affiliation: 13 | - id : "" 14 | institution : "University of Cologne" 15 | 16 | abstract: | 17 | This document showcases some `apa_table()` examples. 18 | 19 | bibliography : "apa_table_example.bib" 20 | 21 | floatsintext : no 22 | linenumbers : yes 23 | draft : no 24 | mask : no 25 | 26 | figurelist : no 27 | tablelist : no 28 | footnotelist : no 29 | 30 | classoption : "man" 31 | output : papaja::apa6_pdf 32 | --- 33 | 34 | ```{r setup, include = FALSE} 35 | library("papaja") 36 | library("psych") 37 | r_refs("r-references.bib") 38 | 39 | knitr::opts_chunk$set(echo = TRUE) 40 | ``` 41 | 42 | ```{r analysis-preferences} 43 | # Seed for random number generation 44 | set.seed(42) 45 | knitr::opts_chunk$set(cache.extra = knitr::rand_seed) 46 | ``` 47 | 48 | ```{r load-data} 49 | load("../../src/slides/cosmetic_surgery.Rdata") 50 | ``` 51 | 52 | ```{r fit-models} 53 | lm1 <- lm(formula = Post_QoL ~ BDI, data = cosmetic_surgery) 54 | lm2 <- lm(formula = Post_QoL ~ Base_QoL + BDI, data = cosmetic_surgery) 55 | lm3 <- lm(formula = Post_QoL ~ Base_QoL + Age + Gender + BDI, data = cosmetic_surgery) 56 | 57 | lm3_apa <- apa_print(lm3) 58 | 59 | mod_comp_apa <- apa_print( 60 | list(Bivariate = lm1, Baseline = lm2, Demographics = lm3) 61 | , anova_fun = anova 62 | , boot_samples = 0 63 | ) 64 | ``` 65 | 66 | (ref:regression-table-caption) Results of model comparisons between three set of linear regression models that describe participants' quality of life post surgery. 67 | 68 | (ref:regression-table-note) The predictor *Gender* was dummy coded with females as reference category. BDI = Beck's depression inventory [@bdi], *Bas QoL* = Quality of life at baseline. 69 | 70 | ```{r regression-table-syntax} 71 | apa_table( 72 | lm3_apa$table 73 | , caption = "(ref:regression-table-caption)" 74 | , note = "(ref:regression-table-note)" 75 | ) 76 | ``` 77 | 78 | (ref:mod-comp-table-caption) Results of model comparisons between three set of linear regression models that describe participants' quality of life post surgery. 79 | 80 | (ref:mod-comp-table-note) The predictor *Gender* was dummy coded with females as reference category. BDI = Beck's depression inventory [@bdi], *Bas QoL* = Quality of life at baseline, AIC = Akaike information criterion, BIC = Bayesian information criterion. 81 | 82 | ```{r standard-table, results = "asis"} 83 | apa_table( 84 | mod_comp_apa$table 85 | , align = "lrrr" 86 | , caption = "(ref:mod-comp-table-caption)" 87 | , note = "(ref:mod-comp-table-note)" 88 | , escape = TRUE 89 | ) 90 | ``` 91 | 92 | ```{r more-elaborate-table, results = "asis"} 93 | apa_table( 94 | mod_comp_apa$table 95 | , align = "lrrr" 96 | , caption = "(ref:mod-comp-table-caption)" 97 | , note = "(ref:mod-comp-table-note)" 98 | , escape = FALSE 99 | , col_spanners = list("Covariate models" = c(3, 4)) 100 | , stub_indents = list("Predictors" = 1:5, "Model fit" = 6:12, "Model comparison" = 13:19) 101 | , midrules = c(6, 14) 102 | # , font_size = "tiny" 103 | , longtable = TRUE 104 | ) 105 | ``` 106 | 107 | ```{r descriptives} 108 | descriptives <- describeBy( 109 | subset(cosmetic_surgery, select = -c(ID, Clinic, Surgery, Gender, Reason)) 110 | , cosmetic_surgery$Reason 111 | ) 112 | 113 | class(descriptives) 114 | 115 | descriptives <- unclass(descriptives) 116 | is.list(descriptives) 117 | 118 | # Add variable labels to each data.frame in the list 119 | descriptive_labels <- c( 120 | # vars = "Variable" 121 | n = "$n$" 122 | , mean = "$\\overline{M}$" 123 | , sd = "$SD$" 124 | , median = "$\\widetilde{M}$" 125 | , trimmed = "$\\overline{M_t}$" 126 | , mad = "MAD" 127 | , min = "Min" 128 | , max = "Max" 129 | , range = "Range" 130 | , skew = "$\\gamma_1$" 131 | , kurtosis = "$\\gamma_4$" 132 | , se = "$SE$" 133 | ) 134 | 135 | descriptives[[1]]$n <- as.integer(descriptives[[1]]$n) 136 | descriptives[[1]]$vars <- NULL 137 | descriptives[[2]]$n <- as.integer(descriptives[[2]]$n) 138 | descriptives[[2]]$vars <- NULL 139 | 140 | variable_labels(descriptives[[1]]) <- descriptive_labels 141 | variable_labels(descriptives[[2]]) <- descriptive_labels 142 | ``` 143 | 144 | (ref:descriptives-table) Predictor descriptives seperately for reported reason for surgery. 145 | 146 | ```{r merged-table, results = "asis"} 147 | apa_table( 148 | descriptives 149 | , align = c("l", rep("r", 12)) 150 | , caption = "(ref:descriptives-table)" 151 | , added_stub_head = "Variable" 152 | , midrules = c(1, 5, 6) 153 | , landscape = TRUE 154 | ) 155 | ``` 156 | 157 | 158 | \newpage 159 | 160 | # References 161 | 162 | ::: {#refs} 163 | ::: 164 | -------------------------------------------------------------------------------- /exercises/3_papaja_table_example/apa_table_example.bib: -------------------------------------------------------------------------------- 1 | @article{bdi, 2 | author = { Aaron T. Beck and Robert A. Steer and Roberta Ball and William F. Ranieri }, 3 | title = {Comparison of Beck Depression Inventories-IA and-II in Psychiatric Outpatients}, 4 | journal = {Journal of Personality Assessment}, 5 | volume = {67}, 6 | number = {3}, 7 | pages = {588-597}, 8 | year = {1996}, 9 | publisher = {Routledge}, 10 | doi = {10.1207/s15327752jpa6703\_13} 11 | } 12 | @Article{BrainerdFalserecognitionreversalWhen1995, 13 | title = {False-Recognition Reversal: {{When}} Similarity Is Distinctive}, 14 | volume = {34}, 15 | url = {http://search.proquest.com/openview/7db6e19dc254858761b3b3e4949554fb/1?pq-origsite=gscholar&cbl=1819609}, 16 | shorttitle = {False-Recognition Reversal}, 17 | number = {2}, 18 | journaltitle = {Journal of Memory and Language}, 19 | author = {Charles J. Brainerd and V. F. Reyna and R. Kneer}, 20 | urldate = {2016-07-05}, 21 | date = {1995}, 22 | pages = {157}, 23 | note = {00219}, 24 | file = {/Users/frederikaust/Zotero/storage/BA6BPCKK/Brainerd et al. - 1995 - False-recognition reversal When similarity is dis.pdf}, 25 | } 26 | 27 | @Article{BrainerdFalseRecognitionReversalWhen1995, 28 | title = {False-{{Recognition Reversal}}: {{When Similarity}} Is {{Distinctive}}}, 29 | volume = {34}, 30 | shorttitle = {False-{{Recognition Reversal}}}, 31 | abstract = {On a recognition test, if presentation of a memory target (e.g., CAT) is used to prime-related distractors (e.g., ANIMAL, DOG), common sense and global memory theories expect that false-recognition rates will increase relative to unrelated distractors. However, counterintuitively, fuzzy-trace theory predicts that false-recognition rates will decrease and that, in some instances, related distractors will be easier to reject than unrelated distractors. In five experiments, this reversal of the usual false-recognition effect was observed for associates, category exemplars, category names, and rhymes. False-recognition reversals increased with age, with amount of target repetition, with degree of target priming, and decreased with length of retention interval.}, 32 | number = {2}, 33 | journaltitle = {Journal of Memory and Language}, 34 | author = {C. J. Brainerd and V. F. Reyna and R. Kneer}, 35 | date = {1995-04}, 36 | pages = {157--185}, 37 | note = {00219}, 38 | file = {/Users/frederikaust/Zotero/storage/RWUPGWMM/Brainerd_etal_1995_False-Recognition_Reversal.pdf}, 39 | } 40 | 41 | @Article{Piercemodalityeffectfalse2005, 42 | langid = {english}, 43 | title = {The Modality Effect in False Recognition: {{Evidence}} for Test-Based Monitoring}, 44 | volume = {33}, 45 | issn = {0090-502X, 1532-5946}, 46 | url = {http://link.springer.com/article/10.3758/BF03193373}, 47 | doi = {10.3758/BF03193373}, 48 | shorttitle = {The Modality Effect in False Recognition}, 49 | abstract = {Harvard University, Cambridge, Massachusetts False recognition in the Deese/Roediger—McDermott (DRM) paradigm has been shown to be greater following auditory study than following visual study, but there are competing explanations for this effect. We generalized this phenomenon in Experiment 1, finding an equivalent modality effect for associative (DRM) lists and categorized lists. Because conscious generation and subsequent monitoring of related lures during study is infrequent for categorized lists, this result is inconsistent with the idea that the modality effect is due to a study-based monitoring process. An alternative explanation is that visual study impairs relational processing relative to auditory study, which could cause a modality effect by lowering false recognition of related lures. We tested this idea in Experiment 2, by switching to a meaning-based test that is sensitive only to the retrieval of relational information. A modality effect was not obtained for either type of list on this test. The results from both experiments were predicted by a test-based monitoring account, rather than by the study-based monitoring or relational processing accounts.}, 50 | number = {8}, 51 | journaltitle = {Memory \& Cognition}, 52 | shortjournal = {Memory \& Cognition}, 53 | author = {Benton H. Pierce and David A. Gallo and Jonathan A. Weiss and Daniel L. Schacter}, 54 | urldate = {2016-09-27}, 55 | date = {2005-12}, 56 | pages = {1407--1413}, 57 | note = {00040}, 58 | keywords = {Cognitive Psychology}, 59 | file = {/Users/frederikaust/Zotero/storage/VFBIT5ZV/Pierce et al. - 2005 - The modality effect in false recognition Evidence.pdf}, 60 | } 61 | -------------------------------------------------------------------------------- /exercises/7_docker_example/Dockerfile: -------------------------------------------------------------------------------- 1 | # Select base image 2 | FROM rocker/rstudio:4.1.2 3 | 4 | # System libraries 5 | RUN apt-get update \ 6 | && apt-get install -y --no-install-recommends \ 7 | libgsl0-dev \ 8 | libnlopt-dev \ 9 | libxt6 \ 10 | ssh 11 | 12 | # TeX Live 13 | ENV CTAN_REPO=http://mirror.ctan.org/systems/texlive/tlnet 14 | RUN /rocker_scripts/install_texlive.sh 15 | ENV PATH=$PATH:/usr/local/texlive/bin/x86_64-linux 16 | 17 | RUN tlmgr install \ 18 | apa6 apa7 booktabs caption csquotes \ 19 | endfloat environ etoolbox fancyhdr \ 20 | fancyvrb framed lineno microtype mptopdf \ 21 | ms parskip pgf sttools threeparttable \ 22 | threeparttablex trimspaces txfonts upquote url was xcolor \ 23 | geometry amsmath kvoptions kvsetkeys kvdefinekeys ltxcmds zapfding \ 24 | auxhook infwarerr multirow babel-english stringenc uniquecounter \ 25 | epstopdf-pkg grfext bigintcalc bitset etexcmds gettitlestring \ 26 | hycolor hyperref intcalc letltxmacro pdfescape refcount rerunfilecheck 27 | 28 | # Setup R packages for papaja 29 | RUN install2.r --error \ 30 | --skipinstalled \ 31 | tinytex \ 32 | remotes \ 33 | markdown \ 34 | mime 35 | 36 | ## Latest papaja development version 37 | RUN Rscript -e "remotes::install_github('crsh/papaja')" 38 | -------------------------------------------------------------------------------- /exercises/gapminder_example.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Exploring Gapminder data" 3 | author: "R User" 4 | date: "`r Sys.Date()`" 5 | output: 6 | html_document: 7 | toc: true 8 | toc_depth: 2 9 | number_sections: true 10 | --- 11 | 12 | ```{r setup, include=FALSE} 13 | knitr::opts_chunk$set(echo = TRUE, 14 | message = FALSE) 15 | 16 | options(scipen = 10, 17 | digits = 2) 18 | 19 | library(tidyverse) 20 | library(gapminder) 21 | ``` 22 | 23 | # The data 24 | 25 | In this report, we explore data from [*Gapminder*](https://www.gapminder.org/). More specifically, we use an excerpt from these data that is included in the [`gapminder` package for `R`](https://github.com/jennybc/gapminder). The data contains information about life expectancy, population, and GDP per capita for `r n_distinct(gapminder$country)` countries from `r n_distinct(gapminder$continent)` different continents, spanning the time from `r min(gapminder$year)` to `r max(gapminder$year)`. 26 | 27 | # Analyses 28 | 29 | For our exploration, we will focus on data from the year 2007. 30 | 31 | ```{r wrangle-data, echo=FALSE} 32 | gap_2007 <- gapminder %>% 33 | filter(year == 2007) 34 | ``` 35 | 36 | ## Life expectancy 37 | 38 | In 2007, life expectancy ranged from `r min(gapminder$lifeExp)` to `r max(gapminder$lifeExp)`, with a global average of `r mean(gapminder$lifeExp)`. 39 | 40 | ```{r lifeExp-dist, fig.cap="Distribution of life expectancy in 2007"} 41 | gap_2007 %>% 42 | ggplot(aes(x = lifeExp)) + 43 | geom_density(fill="#69b3a2", 44 | color="#e9ecef") + 45 | scale_y_continuous(expand=expansion(mult=c(0,0.1))) + 46 | scale_x_continuous(expand=expansion(mult=c(0,0))) + 47 | theme_minimal() 48 | ``` 49 | 50 | ```{r gap-toplife} 51 | gap_2007 %>% 52 | select(country, continent,lifeExp) %>% 53 | arrange(-lifeExp) %>% 54 | head(10) %>% 55 | knitr::kable(caption = "10 countries with the highest life expectancy in 2007") 56 | ``` 57 | 58 | ```{r box-life, fig.cap="Differences between continents in average life expectancy in 2007"} 59 | gap_2007 %>% 60 | ggplot(aes(x = continent, y = lifeExp)) + 61 | geom_boxplot(outlier.colour = "hotpink") + 62 | geom_jitter(position = position_jitter(width = 0.1, height = 0), 63 | alpha = 0.25) 64 | ``` 65 | 66 | ## GDP per capita 67 | 68 | The minimum GDP per capita in 2007 was `r min(gapminder$gdpPercap)`, the maximum was `r max(gapminder$gdpPercap)`, and the worldwide mean was `r mean(gapminder$gdpPercap)`. 69 | 70 | As we can see, GDP per capita is heavily right-skewed. 71 | 72 | ```{r gdp-dist, fig.cap="Distribution of GPD per capita in 2007"} 73 | gap_2007 %>% 74 | ggplot(aes(x = gdpPercap)) + 75 | geom_density(fill="#69b3a2", 76 | color="#e9ecef") + 77 | scale_y_continuous(expand=expansion(mult=c(0,0.1))) + 78 | scale_x_continuous(expand=expansion(mult=c(0,0))) + 79 | theme_minimal() 80 | ``` 81 | 82 | ```{r gap-topgdp} 83 | gap_2007 %>% 84 | select(country, continent,gdpPercap) %>% 85 | arrange(-gdpPercap) %>% 86 | head(10) %>% 87 | knitr::kable(caption = "10 countries with the highest GDP per capita in 2007") 88 | ``` 89 | 90 | ```{r box-gdp, fig.cap="Differences between continents in GDP per capita in 2007"} 91 | gap_2007 %>% 92 | ggplot(aes(x = continent, y = gdpPercap)) + 93 | geom_boxplot(outlier.colour = "hotpink") + 94 | geom_jitter(position = position_jitter(width = 0.1, height = 0), 95 | alpha = 0.25) 96 | ``` 97 | 98 | ## Relationship between life expectancy and GDP per capita 99 | 100 | We employ a bubble plot as made popular by the [TED talk by Hans Rosling](https://www.ted.com/talks/hans_rosling_the_best_stats_you_ve_ever_seen) to visualize the relationship between GDP per capita and life expectancy in 2007. The plot also includes visual information about the continent on which a country is located as well as its population size. 101 | 102 | ```{r bubble} 103 | gap_2007 %>% 104 | ggplot(aes(x = gdpPercap, y = lifeExp)) + 105 | geom_point(aes(size = pop, 106 | color = continent), 107 | alpha = .5) + 108 | scale_x_log10() + 109 | labs(caption = "Due to the heavily skewed distribution of GDP per capita, the X-axis uses a log-scale") 110 | ``` 111 | 112 | # Reproducibility information 113 | 114 | This document was created with the following settings: 115 | 116 | ```{r session-info, echo=FALSE} 117 | sessionInfo() %>% 118 | print(locale = FALSE) 119 | ``` 120 | -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Render slides and assignments 4 | Rscript -e "targets::tar_make()" 5 | 6 | # # Convert slides to PDF using decktape Docker container 7 | # cd slides 8 | # 9 | # for slidedeck in $PWD/*.html 10 | # do 11 | # docker run -t -v `pwd`:$PWD -v ~:/home/user astefanutti/decktape --chrome-arg=--allow-file-access-from-files -s 1024x768 "$slidedeck" slides.pdf 12 | # docker cp `docker ps -lq`:slides/slides.pdf "${slidedeck/html/pdf}" 13 | # docker rm `docker ps -lq` 14 | # done 15 | -------------------------------------------------------------------------------- /outline.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "" 3 | subtitle: "Workshop outline" 4 | author : "Johannes Breuer, Frederik Aust" 5 | 6 | date : "27.-28.04.2022" 7 | location: "KU Leuven" 8 | 9 | abstract: | 10 | For several years, psychological science has been facing a crisis of confidence fueled by concerns about low rates of successful replications of empirical findings. 11 | Different solutions have been proposed to address this issue. 12 | A key factor in these efforts is increasing transparency and computational reproducibility of psychological research. 13 | While transparent and computationally reproducible research is not necessarily more replicable, it facilitates replication attempts and helps to foster trust in empirical findings. 14 | The evolving open science ecosystem provides a variety of tools and services that can be used to implement reproducible research practices. 15 | Navigating the growing space of tools and practices, however, can be a daunting task. 16 | 17 | Hence, the purpose of this 2 days workshop is to introduce researchers to the essential components of tailored reproducible research workflows as well as the tools for implementing them. 18 | Combining lectures with practical hands-on sessions, the workshop will focus on data analysis, reporting of results, and sharing data and materials. 19 | Regarding the tool stack, the workshop will cover version control with Git and writing reports with RMarkdown as key components of a reproducible research workflow, but will also introduce other tools, such as the Open Science Framework (OSF), Docker, and Binder. 20 | 21 | output: 22 | html_document: 23 | keep_md : true 24 | theme : "spacelab" 25 | df_print : "kable" 26 | toc : true 27 | toc_float : true 28 | --- 29 | 30 | 31 | 32 | --- 33 | 34 | ## Learning objectives 35 | 36 | Upon course completion, participants should 37 | 38 | 1. be familiar with key concepts of reproducible research 39 | 2. be able to choose the appropriate tools to implement a tailored workflow 40 | 3. have gained basic proficiency of Git, LaTeX, R Markdown, and `papaja` 41 | 4. be able to manage projects and collaborate using Git and GitHub 42 | 43 | ## Prerequisites 44 | 45 | Participants should have some basic knowledge of R have used R Studio before. 46 | 47 | --- 48 | 49 | # Preparations 50 | 51 | To make the most of our time, we recommend that you prepare for the workshop by installing the following software ahead of time. 52 | 53 | *Please note that these preparations will require some time to complete. Please do not delay them to the last moment before the workshop.* 54 | 55 | ### R and RStudio 56 | 57 | Please ensure that you are using a recent version of R ($\geq$ 4.0.0) and RStudio. 58 | 59 | ### LaTeX 60 | 61 | To enable `papaja`'s full set of features you need a [TeX](http://de.wikipedia.org/wiki/TeX) distribution. 62 | We recommend that you use [TinyTex](https://yihui.name/tinytex/), a LaTeX distribution designed for use with R Markdown. 63 | TinyTex can be installed from within R as follows. 64 | 65 | 66 | ```r 67 | # If necessary, install tinytex R package 68 | if(!requireNamespace("tinytex", quietly = TRUE)) install.packages("tinytex") 69 | 70 | # Install TinyTex distribution 71 | tinytex::install_tinytex() 72 | ``` 73 | 74 | If you prefer, you may also use [MikTeX](http://miktex.org/) for Windows, [MacTeX](https://tug.org/mactex/) for Mac, or [TeX Live](http://www.tug.org/texlive/) for Linux. 75 | Refer to the [`papaja` manual](https://crsh.github.io/papaja_man/introduction.html#getting-started) for instructions. 76 | 77 | 78 | #### `papaja` 79 | 80 | `papaja` is not yet available on CRAN but you can install it from this repository: 81 | 82 | 83 | ```r 84 | # Install remotes package if necessary 85 | if(!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") 86 | 87 | # Install the latest development snapshot from GitHub 88 | remotes::install_github("crsh/papaja") 89 | ``` 90 | 91 | 92 | 93 | ### Git and GitHub 94 | 95 | We will use Git for version control (change tracking) and as a tool for collaboration. 96 | The following steps may be daunting at first, but the linked-to instructions are excellent and should get you set up in no time. 97 | You can do it! :) 98 | 99 | In preparation, please 100 | 101 | 1. create a [GitHub](https://github.com) account 102 | 2. install Git (see [instructions](https://happygitwithr.com/install-git.html)) 103 | - During installation of Git, add `git bash` to the Windows context menu by selecting its option (this should be the default) 104 | 3. configure Git (see [ instructions](https://happygitwithr.com/hello-git.html)) 105 | 2. create a personal access token for HTTPS (see [instructions](https://happygitwithr.com/https-pat.html)) 106 | 4. confirm that you can connect to GitHub (see [instructions](https://happygitwithr.com/push-pull-github.html)) 107 | -------------------------------------------------------------------------------- /reproducible-research-practices-workshop.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: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Custom 19 | CustomScriptPath: make.sh 20 | -------------------------------------------------------------------------------- /slides/1_introduction.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/1_introduction.pdf -------------------------------------------------------------------------------- /slides/2_Intro_RMarkdown.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/2_Intro_RMarkdown.pdf -------------------------------------------------------------------------------- /slides/3_papaja.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/3_papaja.pdf -------------------------------------------------------------------------------- /slides/4_git_github.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/4_git_github.pdf -------------------------------------------------------------------------------- /slides/5_Git-RStudio.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/5_Git-RStudio.pdf -------------------------------------------------------------------------------- /slides/6_github_collaboration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/6_github_collaboration.pdf -------------------------------------------------------------------------------- /slides/7_Other_Topics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/slides/7_Other_Topics.pdf -------------------------------------------------------------------------------- /src/exercises/2_rmarkdown.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: Intro to R Markdown" 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | # Preliminaries 10 | 11 | You can find the solutions for this exercise as well as the following ones in the `exercises` folder within the workshop materials. You can easily copy code from these solution files by clicking on the small blue clipboard icon in the upper right corner of the solution boxes showing the code. 12 | 13 | In this exercise, we will create a first `R Markdown` document. The example data we use here comes from the [`gapminder` package](https://github.com/jennybc/gapminder) which is based on data from [the non-profit with the same name](https://www.gapminder.org/). However, if you prefer to use other or your own data for this exercise as well as the following ones, feel free to do so. 14 | 15 | Please also feel free to change and play around with any of the other parameters in this exercise (e.g., output format, chunk options, document content, etc.). 16 | 17 | # Exercises 18 | 19 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 20 | Create a new `R Markdown` document, give it a meaningful name, and save it somewhere in your project folder where you will find it. The output format that we want to use for this exercise is `HTML` 21 | ``` 22 | 23 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 24 | The easiest way to create a new `R Markdown` document is through the *RStudio* GUI. 25 | ``` 26 | 27 | ```{block, box.title = "Solution 1", solution = TRUE, box.icon = "fa-check"} 28 | You can create a new `R Markdown` document in *RStudio* via *File* -> *New File* -> *R Markdown* in the menu. 29 | ``` 30 | 31 | ```{block, box.title = "Exercise 2", box.body = list(fill = "white"), box.icon = "fa-star"} 32 | Create/edit the `YAML` header of the document, so that it includes the following: a meaningful title, an author name, the current date. 33 | 34 | We also want a table of contents with two levels and numbered headings. 35 | ``` 36 | 37 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 38 | You can already specify some parts of the `YAML` header through the *RStudio* GUI when creating a new document. To add the current date, you can use inline `R` code in the respective field within the `YAML` header. Remember that you need to enclose the `YAML` header in --- . 39 | ``` 40 | 41 | ```{block, box.title = "Solution 2", solution = TRUE, box.icon = "fa-check"} 42 | title: "Exploring Gapminder data" 43 | author: "Your name" 44 | date: "`r Sys.Date()`" 45 | output: 46 | html_document: 47 | toc: true 48 | toc_depth: 2 49 | number_sections: true 50 | ``` 51 | 52 | ```{block, box.title = "Exercise 3", box.body = list(fill = "white"), box.icon = "fa-star"} 53 | Include a setup chunk in your document. Use this chunk to set the `knitr` options so that the code is displayed in the output document but messages are suppressed. 54 | 55 | Three other things we want to do in the setup chunk: 56 | 57 | - set the "penalty to be applied when deciding to print numeric values in fixed or exponential notation" to 10 58 | - set the number of significant digits to print to 2 59 | - load the packages `gapminder` and `tidyverse` 60 | ``` 61 | 62 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 63 | For the general options (i.e., the one not related to `knitr`), you can check `?options`. 64 | 65 | You probably do not want to include the chunk options as code output in the resulting `HTML` document. You can achieve this by setting the chunk option `include` to `FALSE` for the setup chunk. 66 | 67 | Of course, if you want to use additional/other packages, you can also add those to the setup chunk. 68 | ``` 69 | 70 | ```{block, box.title = "Solution 3", solution = TRUE, box.icon = "fa-check"} 71 | Chunk options: {r setup, include=FALSE} 72 | (for the code to be included in this chunk, see the following solution box) 73 | 74 | *NB*: In your `R Markdown` document, a code block needs to start and end with three backticks. Remember that in *RStudio* you can use the keyboard shortcut Ctrl + Alt + I (*Windows* & *Linux*)/Cmd + Option + I (*Mac*) for inserting code chunks. 75 | ``` 76 | 77 | ```{r setup, box.title = "Solution 3", solution = TRUE, box.icon = "fa-check", eval=FALSE} 78 | knitr::opts_chunk$set(echo = TRUE, 79 | message = FALSE) 80 | 81 | options(scipen = 10, 82 | digits = 2) 83 | 84 | library(tidyverse) 85 | library(gapminder) 86 | ``` 87 | 88 | ```{block, box.title = "Exercise 4", box.body = list(fill = "white"), box.icon = "fa-star"} 89 | Now you can start to create some [content](https://www.youtube.com/watch?v=9Tnux7K3MOQ) for your document. You can get as creative as you want, but the document should at least include the following: 90 | 91 | - two different levels of headings 92 | 93 | - some basic text formatting and links 94 | 95 | - some inline code 96 | 97 | - code chunks with different options 98 | 99 | - at least one table 100 | 101 | - at least one figure 102 | ``` 103 | 104 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 105 | To check if everything works the way you expect, you should knit the document periodically. We have created an exemplary `.Rmd` file using the *Gapminder* data. You can find this in the `exercises` folder. 106 | 107 | Please note that in the exemplary `R Markdown` document we use the [`dplyr` package](https://dplyr.tidyverse.org/) from the [`tidyverse`](https://www.tidyverse.org/) for data wrangling and [`ggplot2`](https://ggplot2.tidyverse.org/) for plotting. If you are not used to that or have other preferences, feel free to use `base R` or other packages of your choosing instead. 108 | ``` 109 | 110 | ```{block, box.title = "Solution 4", solution = TRUE, box.icon = "fa-check"} 111 | Have a look at `gapminder_example.Rmd` and the resulting `gapminder_example.html` for some examples and inspiration. 112 | ``` 113 | 114 | ```{block, box.title = "Exercise 5", box.body = list(fill = "white"), box.icon = "fa-star"} 115 | To further increase reproducibility, let's add some information about your `R` session (OS, `R` version, loaded packages) to the document. Add a section named *Reproducibility information* at the end of your document and display this information there. 116 | ``` 117 | 118 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 119 | You can use a `base R` function to access information about your session (function name hint 1) and another one for printing it (function name hint 2). You can exclude information about your `locale` settings there. 120 | ``` 121 | 122 | ```{r session-info, box.title = "Solution 5", solution = TRUE, box.icon = "fa-check", eval=FALSE} 123 | sessionInfo() %>% 124 | print(locale = FALSE) 125 | ``` 126 | 127 | Once you are satisfied with the result (or when we tell you that the time for this exercise is over), knit the document, add the files to `Git`, commit your changes (adding a meaningful commit message), and push them to your remote repository. 128 | -------------------------------------------------------------------------------- /src/exercises/3_papaja.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: Introduction to papaja" 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | 10 | ## Document template 11 | 12 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 13 | Create a new **papaja** document from the R Markdown templates. 14 | ``` 15 | 16 | ```{block, box.title = "Solution 1", box.icon = "fa-check", solution = TRUE} 17 | `File > New File > R Markdown... > From Template` 18 | ``` 19 | 20 | 21 | ```{block, box.title = "Exercise 2", box.body = list(fill = "white"), box.icon = "fa-star"} 22 | Locate the example manuscript in the folder `exercises/3_papaja_example_manuscript` and open the file `manuscript.pdf` or `manuscript.docx`. 23 | 24 | Populate the YAML front matter of your **papaja** document by transfering the metadata from the example manuscript. 25 | ``` 26 | 27 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 28 | The manuscript contains no note or contributorship information. 29 | The `note`field and each author's `role` field can simply be omitted. 30 | ``` 31 | 32 | ```{yaml, box.title = "Solution 2", box.icon = "fa-check", solution = TRUE} 33 | title: "Distorted estimates of implicit and explicit learning in applications of the process-dissociation procedure to the SRT task" 34 | shorttitle: "Distorted PD estimates in sequence learning" 35 | 36 | author: 37 | - name: "Christoph Stahl" 38 | affiliation: "" 39 | corresponding: yes 40 | address: "Herbert-Lewin-Straße 2, 50931 Köln" 41 | email: "christoph.stahl@uni-koeln.de" 42 | - name: "Marius Barth" 43 | affiliation: "" 44 | - name: "Hilde Haider" 45 | affiliation: "" 46 | 47 | affiliation: 48 | - id: "" 49 | institution: "University of Cologne" 50 | 51 | authornote: | 52 | This work was funded by Deutsche Forschungsgemeinschaft grants STA-1269/1-1 and HA-5447/8-1. 53 | 54 | abstract: | 55 | We investigated potential biases affecting the validity of the process-dissociation (PD) procedure when applied to sequence learning. 56 | Participants were or were not exposed to a serial reaction time task (SRTT) with two types of pseudo-random materials. 57 | Afterwards, participants worked on a free or cued generation task under inclusion and exclusion instructions. 58 | Results showed that pre-experimental response tendencies, 59 | non-associative learning of location frequencies, 60 | and the usage of cue locations introduced bias to PD estimates. 61 | These biases may lead to erroneous conclusions regarding the presence of implicit and explicit knowledge. 62 | Potential remedies for these problems are discussed. 63 | 64 | keywords: "implicit learning, serial reaction time task, process-dissociation procedure, response bias" 65 | wordcount: "8,167" 66 | ``` 67 | 68 | 69 | ```{block, box.title = "Exercise 3", box.body = list(fill = "white"), box.icon = "fa-star"} 70 | Make your manuscript preprint-ready: Hide line numbers and add a "DRAFT" watermark. 71 | ``` 72 | 73 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 74 | Use the `draft` and `linenumbers` options in the YAML front matter. 75 | ``` 76 | 77 | ```{yaml, box.title = "Solution 3", box.icon = "fa-check", solution = TRUE} 78 | draft: yes 79 | linenumbers: no 80 | ``` 81 | 82 | ```{block, box.title = "Bonus", box.body = list(fill = "white"), box.icon = "fa-medal", box.collapse = TRUE} 83 | Try the single-column single-spaced document style by using the `"doc"` class option. 84 | ``` 85 | 86 | ```{yaml, box.title = "Bonus solution", box.icon = "fa-check", solution = TRUE, box.collapse = TRUE} 87 | classoption: "doc" 88 | ``` 89 | 90 | 91 | ## Citations 92 | 93 | ```{block, box.title = "Exercise 4", box.body = list(fill = "white"), box.icon = "fa-star"} 94 | Copy the introduction of the example manuscript into your document. Use the visual editor or the RStudio addin [`citr`](https://github.com/crsh/citr) to insert citations. 95 | ``` 96 | 97 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 98 | Don't forget to add the bibliography file(s) to your YAML front matter. 99 | ``` 100 | 101 | ```{block, box.title = "Solution 4", box.icon = "fa-check", solution = TRUE} 102 | Add the the bibliography files to the YAML front matter: 103 | 104 |
105 | bibliography: ["references.bib", "r-references.bib"]
106 | 
107 | 108 | The following is an examplary excerpt of what you citations could look like: 109 | 110 |
111 | One of the most frequently utilized paradigms in the field of implicit learning is the serial reaction time task (SRTT) originating from @nissen_attentional_1987. [...] Even with more sensitive tests including the recently introduced wagering task [@dienes_gambling_2010; @haider_old_2011;  @persaud_postdecision_2007] or the process-dissociation procedure [@destrebecqz_can_2001; @haider_old_2011; @jacoby_process_1991], explicit knowledge of the sequence is rare.
112 | 
113 | ``` 114 | 115 | 116 | ## Report statistical analyses 117 | 118 | ```{block, box.title = "Exercise 5", box.body = list(fill = "white"), box.icon = "fa-star"} 119 | Locate and open the R-script `analyses.R` and data folder `data` accompanying the example manuscript in the folder `exercises/3_papaja_example_manuscript`. 120 | 121 | Use `apa_print()` to report the results of one or more analysis using in-line code chunks in your **papaja** document. 122 | ``` 123 | 124 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 125 | Use the section comments (e.g., `## ----setup----`) to split the R script into meaningful code chunks and use the section headings as chunk names. 126 | 127 | You may omit parts of the R script that are not necessary for the analysis you are trying to insert into your document. 128 | ``` 129 | 130 | ```{block, box.title = "Solution 5", box.icon = "fa-check", solution = TRUE} 131 | The following is a minimal example of how to report one hypothesis test of one of the analyses. 132 | 133 |
134 | ```{r setup}
135 | # load packages
136 | library("papaja")
137 | library("afex")
138 | ```
139 | 
140 | ```{r prepare-data}
141 | acquisition <- readRDS("data/acquisition-task.rds")
142 | ```
143 | 
144 | ```{r acquisition-rt}
145 | # within the permuted-material group, high vs. low frequency locations can be distinguished
146 | tmp.perm <- acquisition[
147 |   acquisition$error == 0 &
148 |   acquisition$trial > 1 &
149 |   acquisition$included_participant &
150 |   acquisition$material == "Permuted" &
151 |   !is.na(acquisition$frequency),
152 | ]
153 | 
154 | permuted_aov <- aov_ez(
155 |   data = tmp.perm
156 |   , dv = "SRI"
157 |   , within = c("block", "frequency")
158 |   , id = "id"
159 | )
160 | 
161 | 
permuted_res <- apa_print(permuted_aov)
``` 162 | 163 |
The effect of *frequency* was significant, `r permuted_res$full_result$frequency`.
164 | ``` 165 | 166 | ```{block, box.title = "Bonus", box.body = list(fill = "white"), box.icon = "fa-medal", box.collapse = TRUE} 167 | Add the corresponding plot that visualizes the results to your document. 168 | ``` 169 | 170 | ```{block, box.title = "Bonus solution", box.icon = "fa-check", solution = TRUE, box.collapse = TRUE} 171 |
172 | ```{r acquisition-rt-plot}
173 | apa_lineplot(
174 |   data = tmp.perm
175 |   , id = "id"
176 |   , dv = "SRI"
177 |   , factors = c("block", "frequency")
178 |   , dispersion = wsci
179 |   , ylab = ""
180 |   , args_lines = list(lty = c("solid", "solid"))
181 |   , args_points = list(pch = c(21, 21))
182 |   , args_legend = list(legend = c("High", "Low"), title = "Location frequency")
183 |   , ylim = c(475, 650)
184 |   , jit = .05
185 | )
186 | ```
187 | 
188 | ``` 189 | 190 | 191 | ## Rendering tables 192 | 193 | ```{block, box.title = "Exercise 6", box.body = list(fill = "white"), box.icon = "fa-star"} 194 | Locate the section `proportion-correct-table-appendix` at the end of the R-script `analyses.R`. 195 | 196 | Render the table of descriptive statistics for the generation task in your **papaja** document with `apa_table()`. 197 | ``` 198 | 199 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 200 | Use the arguments `col_spanners` and `midrules` to structure the table. To add a caption, use the argument `caption`. See `?apa_table`. 201 | ``` 202 | 203 | ```{block, box.title = "Solution 6", box.icon = "fa-check", solution = TRUE} 204 |
205 | ```{r proportion-correct-table}
206 | tmp <- generation[
207 |   generation$included_participant &
208 |   generation$repetition == 0 &
209 |   generation$post_repetition == 0,
210 | ]
211 | 
212 | # calculate proportion of regular transitions per participant
213 | agg <- aggregate(
214 |   formula = correct_SOC ~ material + generation + order + PD_instruction + id
215 |   , data = tmp
216 |   , FUN = mean
217 |   , na.rm = TRUE
218 | )
219 | 
220 | # calculate condition means and standard errors
221 | means <- aggregate(
222 |   formula = cbind(M = correct_SOC) ~ material + generation + order + PD_instruction
223 |   , data = agg
224 |   , FUN = mean
225 | )
226 | SEs <- aggregate(
227 |   formula = cbind(`SE` = correct_SOC) ~ material + generation + order + PD_instruction
228 |   , data = agg
229 |   , FUN = se
230 | )
231 | 
232 | # merge means and CI width
233 | tab <- merge(means, SEs)
234 | 
235 | # bind Inclusion and Exclusion side-by-side
236 | tab <- cbind(tab[tab$PD_instruction == "Inclusion", ], tab[tab$PD_instruction == "Exclusion", c("M", "SE")])
237 | tab$PD_instruction <- NULL
238 | 
239 | tab$material <- gsub(tab$material, pattern = "-", replacement = " ", fixed = TRUE)
240 | tab$generation <- as.character(tab$generation)
241 | tab$generation[duplicated(paste0(tab$material, tab$generation))] <- ""
242 | tab$material[duplicated(tab$material)] <- ""
243 | 
244 | 
apa_table( 245 | tab 246 | , row.names = FALSE 247 | , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7)) 248 | , midrules = c(4, 8, 12) 249 | , caption = "Means (M) and standard errors (SE) of proportion of correctly generated second-order 250 | conditionals (SOCs)." 251 | , placement = NULL 252 | )
253 | ``` 254 |
255 | ``` 256 | 257 | 258 | ```{block, box.title = "Bonus", box.body = list(fill = "white"), box.icon = "fa-medal", box.collapse = TRUE} 259 | Place the table in the appendix of your document. To start an appendix, use the following special heading: 260 | 261 |
262 | # (APPENDIX) Appendix {-}
263 | 
264 | ``` 265 | 266 | ```{block, box.title = "Bonus solution", box.icon = "fa-check", solution = TRUE, box.collapse = TRUE} 267 |
268 | \newpage
269 | 
270 | # References
271 | 
272 | ::: {#refs custom-style="Bibliography"}
273 | :::
274 | 
275 | 
276 | \newpage
277 | 
278 | # (APPENDIX) Appendix {-}
279 | 
280 | 
281 | ```{r proportion-correct-table-appendix}
282 | apa_table(
283 |   tab
284 |   , row.names = FALSE
285 |   , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7))
286 |   , midrules = c(4, 8, 12)
287 |   , caption = "Means (M) and standard errors (SE) of proportion of correctly generated second-order
288 |     conditionals (SOCs)."
289 |   , placement = NULL
290 | )
291 | ```
292 | 
293 | ``` 294 | 295 | 296 | ## Captions and cross-referencing 297 | 298 | ```{block, box.title = "Exercise 7", box.body = list(fill = "white"), box.icon = "fa-star"} 299 | Use a text-reference for your table caption and reference the table in the body of the text. 300 | ``` 301 | 302 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 303 | Text reference definitions must be on their own line, surrounded by empty lines, and start with `(ref:reference-name)`. 304 | ``` 305 | 306 | ```{block, box.title = "Solution 7", box.icon = "fa-check", solution = TRUE} 307 |
308 | 
(ref:table-caption) Means ($M$) and standard errors ($\mathit{SE}$) of proportion of correctly generated second-order conditionals (SOCs).
309 | 310 | ```{r proportion-correct-table} 311 | apa_table( 312 | tab 313 | , row.names = FALSE 314 | , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7)) 315 | , midrules = c(4, 8, 12) 316 |
, caption = "(ref:table-caption)"
317 | , placement = NULL 318 | ) 319 | ``` 320 |
321 | ``` 322 | 323 | 324 | 325 | -------------------------------------------------------------------------------- /src/exercises/4_git_github.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: Git & GitHub" 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | 10 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 11 | Go to GitHub (or GitLab) and create a new repository for this workshop. 12 | ``` 13 | 14 | ```{block, box.title = "Solution 1", box.icon = "fa-check", solution = TRUE} 15 | ### GitHub 16 | 17 | ![](../slides/img/github-home.png) 18 | 19 | ![](../slides/img/github-new-repo.png) 20 | 21 | --- 22 | 23 | ### GitLab 24 | 25 | ![](../slides/img/gitlab-home.png) 26 | 27 | ![](../slides/img/gitlab-new-repo.png) 28 | ``` 29 | -------------------------------------------------------------------------------- /src/exercises/5_git&rstudio.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: Git & RStudio" 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | 10 | In this set of exercises, we clone and work on the *GitHub* or *GitLab* repository you have created in the previous session. 11 | 12 | In order to do the following exercises, you should have gone through the steps described in the setup information for the workshop. Specifically, you should... 13 | 14 | - make sure that we can use `Git` via *RStudio* 15 | - have created and stored a PAT for authentication via `HTTPS` for *GitHub* 16 | 17 | For using *GitLab* you should also have enabled `SSH` authentication through creating a RSA key in the Git/SVN options in *RStudio*. 18 | 19 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 20 | After we've made sure that everything works, we can now clone and work on the repository we have created on *GitHub* or *GitLab* in the previous session. When doing this, you should also create a new *RStudio* project. 21 | ``` 22 | 23 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 24 | You can create a new version-controlled project that is connected to an existing *GitHub* or *GitLab* repository via the *RStudio* menu. If you need some further information, you can check out the [New project, GitHub first](https://happygitwithr.com/new-github-first.html) section in *Happy Git and GitHub for the useR*. 25 | ``` 26 | 27 | ```{block, , box.title = "Solution 1", solution = TRUE, box.icon = "fa-check"} 28 | You can create a new version-controlled project and associate it with a repository cloned from *GitHub* via *File* -> *New Project* -> *Version Control*. Then choose `Git`, enter the URL of the *GitHub*/*GitLab* repository (remember that the URL looks different depending on whether you use `HTTPS` or `SSH` for authentication), and choose a location where to store the project on your local machine. 29 | As we will start working on the project right away, also check "Open in new session". 30 | ``` 31 | 32 | ```{block, box.title = "Exercise 2", box.body = list(fill = "white"), box.icon = "fa-star"} 33 | If everything has worked, a new instance of *RStudio* should have opened with the working directory set to the location of your new project, the files included in the project folder visible in the *Files* tab, and an active `Git` tab. To make extra sure that everything worked, let's check the `Git` status of our project via the `Terminal` in *RStudio*. 34 | ``` 35 | 36 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 37 | You may want to check which shell the `Terminal` in *RStudio* uses via *Tools* -> *Global Options* -> *Terminal*. If you use Windows, you should choose `Git Bash` (which you should have installed with `Git` for Windows). 38 | ``` 39 | 40 | ```{bash, , box.title = "Solution 2", solution = TRUE, box.icon = "fa-check", eval=FALSE} 41 | git status 42 | ``` 43 | 44 | ```{block, box.title = "Exercise 3", box.body = list(fill = "white"), box.icon = "fa-star"} 45 | Now that the project is set up and in sync with the remote repository, we can start working on it. Modify the README file (just add, remove or edit a few words). If you want to, you can also edit the `R Markdown` file(s) in your repository/project. 46 | 47 | After modifying the file(s), save the changes (via the *Save* icon in the *RStudio* menu or the keyboard shortcut your OS uses for saving files) and stage them in `Git`. 48 | ``` 49 | 50 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 51 | You can use the *RStudio* GUI for staging changes (for modified or added files). As a reminder: When you modify existing files and/or create new ones and save the changes, these should be displayed in the `Git` tab in *RStudio* and their status will be indicated as *modified* or *untracked*. 52 | ``` 53 | 54 | ```{block, , box.title = "Solution 3", solution = TRUE, box.icon = "fa-check"} 55 | You can stage changed files in the *RStudio* GUI by checking the boxes in the *Staged* column in the `Git` tab. 56 | ``` 57 | 58 | ```{block, box.title = "Exercise 4", box.body = list(fill = "white"), box.icon = "fa-star"} 59 | After staging your changes, let's create a commit and push that to the remote repository. 60 | ``` 61 | 62 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 63 | You can do both (committing and pushing) via the *RStudio* GUI. Remember to write a meaningful commit message. 64 | ``` 65 | 66 | ```{block, , box.title = "Solution 4", solution = TRUE, box.icon = "fa-check"} 67 | After staging the changes, simply click on the *Commit* button in the `Git` tab in *RStudio*, write a commit message in the menu that opens up, and then click the *Push* button in the same menu. 68 | ``` 69 | 70 | ```{block, box.title = "Exercise 5", box.body = list(fill = "white"), box.icon = "fa-star"} 71 | As a final exercise for this session, let's do the opposite of pushing and pull changes from the remote repository to your local project. Before we can do this, we first need to make some edits in the remote repository. Go to the website of your remote *GitHub*/*GitLab* repository (while being logged in) and edit the README file in the browser (again, just add, remove, or edit a few words). How you edit a file depends on the platform: 72 | 73 | On *GitHub*: 74 | You can edit the README via the small pen icon next displayed above the content of your README file. 75 | 76 | On *GitLab*: 77 | Click on the name of the file you want to edit (in this case this should be `README.md`). Next, choose and click "Edit" from the blue dropdown menu shown next to the file name. 78 | 79 | Once you have edited the file (and committed the changes directly on *GitHub*/*GitLab*), you can pull the changes to your local project. 80 | ``` 81 | 82 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 83 | Remember that if you edit a file directly via the *GitHub* or *GitLab* web interface, you also need to make a commit (and add a commit message). You can do the pull operation via the respective icon in the *RStudio* GUI. 84 | ``` 85 | 86 | ```{block, , box.title = "Solution 5", solution = TRUE, box.icon = "fa-check"} 87 | After making and saving the edits to the README file via the *GitHub* or *GitLab* web interface, you can simply click the *Pull* button in the `Git` tab in *RStudio* to update your local project. 88 | ``` 89 | -------------------------------------------------------------------------------- /src/exercises/6_github_collaboration.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: Collaborate with Git & GitHub" 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | ## Adding collaborators 10 | 11 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 12 | Find one or two collaborators. Go to GitHub (or GitLab) and add each other as collaborators to your repositories. 13 | ``` 14 | 15 | ```{block, box.title = "Solution 1", box.icon = "fa-check", solution = TRUE} 16 | GitHub: `Settings > Manage access > Add people` 17 | 18 | GitLab: `Project information > Members > Invite members` 19 | ``` 20 | 21 | ## Publish changes without review 22 | 23 | ```{block, box.title = "Exercise 2", box.body = list(fill = "white"), box.icon = "fa-star"} 24 | Now, it's time to start collaborating. 25 | 26 | 1. Clone your collaborators repository into a new directory (not inside your repository!) 27 | 1. Make some constructive changes 28 | 1. Stage, commit, and push all changes to your collaborators remote repository 29 | 1. Pull and review the changes your collaborator has made to your repository 30 | 1. Comment on one of the changes to your repository on GitHub 31 | ``` 32 | 33 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 34 | You may review the changes to your repository on GitHub or in RStudio. In RStudio, click the little clock icon in the Git pane to open the commit history and review the changes. 35 | ``` 36 | 37 | ```{bash, box.title = "Solution 2", box.icon = "fa-check", solution = TRUE, eval = FALSE} 38 | git clone 39 | git add . 40 | git commit -m "Constructive changes" 41 | git push 42 | ``` 43 | 44 | 45 | ## Open a pull request 46 | 47 | ```{block, box.title = "Exercise 3", box.body = list(fill = "white"), box.icon = "fa-star"} 48 | Open your browser and navigate to your collaborator's GitHub repository. 49 | 50 | 1. Choose a file and edit it in your browser 51 | 2. Open a pull request 52 | 3. Review the changes your collaborator has proposed to your repository, accept them, and merge the pull request 53 | ``` 54 | 55 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 56 | After creating a new branch with `git branch my-branch` you have to switch over to that branch before making any edits with `git checkout my-branch`. 57 | 58 | When pushing a newly created branch for the first time, you need to specify where the branch should be pushed to (`git push origin my-branch`). 59 | ``` 60 | 61 | ```{bash, box.title = "Solution 3", box.icon = "fa-check", solution = TRUE, eval = FALSE} 62 | git pull 63 | git branch revision 64 | git checkout revision 65 | git add . 66 | git commit -m "My changes" 67 | git push origin revision 68 | ``` 69 | 70 | 71 | ```{block, box.title = "Exercise 4", box.body = list(fill = "white"), box.icon = "fa-star"} 72 | Start a conversation. Open your collaborator's repository in RStudio. 73 | 74 | 1. Pull the latest changes from the remote repository 75 | 2. Create a new branch 76 | 1. Edit multiple files, stage, commit, and push the changes 77 | 2. Open your collaborator's GitHub repository, find your branch, and open a pull request 78 | 2. Review the changes your collaborator has proposed to your repository and request a change 79 | 3. Make the requested changes to your PR 80 | 4. After reviewing the updated pull requests to your repository, accept and merge it 81 | ``` 82 | 83 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 84 | You can revise your pull request simply by editing the branch in RStudio and pushing the committed changes to GitHub as usual. The pull request will be updated automatically. 85 | ``` 86 | 87 | 88 | ## Merge conflicts 89 | 90 | ```{block, box.title = "Bonus", box.body = list(fill = "white"), box.icon = "fa-medal"} 91 | Together with your collaborator, create a merge conflicts on each others repositories. 92 | 93 | 1. Pull the latest changes from the remote repository 94 | 2. Choose a file and edit the same line in that file in your RStudio and commit the change (do not push, yet). 95 | 3. Let your collaborator push the change to your repository and then try pushing yourself. 96 | 4. Pull the latest changes from the remote repository 97 | 5. Resolve the merge conflict 98 | 6. Push your changes to your repository 99 | ``` 100 | 101 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 102 | When resolving a merge conflict, you can do so in any way you see fit. You can keep your changes or those of your collaborator. You may also combine the changes or discard both and come up with something new. 103 | ``` 104 | 105 | ```{block, box.title = "Bonus solution", box.icon = "fa-check", solution = TRUE} 106 | The file containing the merge conflict might look something like the following. 107 | 108 |
109 | <<<<<<<< HEAD
110 | Your changes
111 | ========
112 | Your collaborator's changes
113 | >>>>>>>> b8e009f666b984509b28a8dedc18e45811be94a6
114 | 
115 | 116 | After resolving the conflict, the file could look as follows. 117 | 118 |
119 | Your and your collaborator's changes
120 | 
121 | 122 | Then you can just stage and commit the conflict resolution as usual. 123 | ``` 124 | -------------------------------------------------------------------------------- /src/exercises/_output.yaml: -------------------------------------------------------------------------------- 1 | unilur::tutorial_html_solution: default 2 | unilur::tutorial_html: default 3 | -------------------------------------------------------------------------------- /src/exercises/_setup.Rmd: -------------------------------------------------------------------------------- 1 | 2 | ```{r custom-boxes, include = FALSE} 3 | knitr::opts_template$set( 4 | clues = list( 5 | box.title = "Clues" 6 | , box.body = list(fill = "#fff9dc", colour = "black") 7 | , box.header = list(fill = "#ffec8b", colour = "black") 8 | , box.icon = "fa-search" 9 | , box.collapse = TRUE 10 | ) 11 | ) 12 | ``` 13 | 14 | ```{r klippy, echo = FALSE} 15 | klippy::klippy(position = c("top", "right")) 16 | ``` 17 | 18 | ```{css, echo = FALSE} 19 | .highlight { 20 | background-color: rgb(255, 150, 79, 0.75); /*#ffcc66;*/ 21 | } 22 | 23 | a:not([href^="#"]):not([href^="/"])::after { 24 | font-family: 'FontAwesome'; 25 | content: " \f08e"; 26 | font-size: 1rem; 27 | vertical-align: top; 28 | } 29 | 30 | a[target="_blank"]:after { 31 | font-family: 'FontAwesome'; 32 | content: " \f08e"; 33 | font-size: 1rem; 34 | vertical-align: top; 35 | } 36 | 37 | pre { 38 | white-space: pre-wrap; /* Since CSS 2.1 */ 39 | white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ 40 | white-space: -pre-wrap; /* Opera 4-6 */ 41 | white-space: -o-pre-wrap; /* Opera 7 */ 42 | word-wrap: break-word; /*Internet Explorer 5.5+ */ 43 | word-break: break-word; /*Internet Explorer 5.5+ */ 44 | } 45 | ``` 46 | -------------------------------------------------------------------------------- /src/exercises/template.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Exercises: " 3 | subtitle : "Reproducible research workflows for psychologists" 4 | --- 5 | 6 | ```{r child = "_setup.Rmd"} 7 | ``` 8 | 9 | 10 | ```{block, box.title = "Exercise 1", box.body = list(fill = "white"), box.icon = "fa-star"} 11 | This is exercise 1. 12 | ``` 13 | 14 | ```{block, opts.label = "clues", box.icon = "fa-lightbulb"} 15 | Not really a lot to do here. 16 | ``` 17 | 18 | ```{block, box.title = "Solution 1", box.icon = "fa-check", solution = TRUE} 19 | Well done! 20 | ``` 21 | -------------------------------------------------------------------------------- /src/outline.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "`r gsub('.+:', '', params$title)`" 3 | subtitle: "Workshop outline" 4 | author : "`r params$author`" 5 | 6 | date : "`r params$date`" 7 | location: "`r params$location`" 8 | 9 | abstract: | 10 | For several years, psychological science has been facing a crisis of confidence fueled by concerns about low rates of successful replications of empirical findings. 11 | Different solutions have been proposed to address this issue. 12 | A key factor in these efforts is increasing transparency and computational reproducibility of psychological research. 13 | While transparent and computationally reproducible research is not necessarily more replicable, it facilitates replication attempts and helps to foster trust in empirical findings. 14 | The evolving open science ecosystem provides a variety of tools and services that can be used to implement reproducible research practices. 15 | Navigating the growing space of tools and practices, however, can be a daunting task. 16 | 17 | Hence, the purpose of this 2 days workshop is to introduce researchers to the essential components of tailored reproducible research workflows as well as the tools for implementing them. 18 | Combining lectures with practical hands-on sessions, the workshop will focus on data analysis, reporting of results, and sharing data and materials. 19 | Regarding the tool stack, the workshop will cover version control with Git and writing reports with RMarkdown as key components of a reproducible research workflow, but will also introduce other tools, such as the Open Science Framework (OSF), Docker, and Binder. 20 | 21 | output: 22 | html_document: 23 | keep_md : true 24 | theme : "spacelab" 25 | df_print : "kable" 26 | toc : true 27 | toc_float : true 28 | --- 29 | 30 | ```{r setup, include = FALSE} 31 | library("rmarkdown") 32 | ``` 33 | 34 | --- 35 | 36 | ## Learning objectives 37 | 38 | Upon course completion, participants should 39 | 40 | 1. be familiar with key concepts of reproducible research 41 | 2. be able to choose the appropriate tools to implement a tailored workflow 42 | 3. have gained basic proficiency of Git, LaTeX, R Markdown, and `papaja` 43 | 4. be able to manage projects and collaborate using Git and GitHub 44 | 45 | ## Prerequisites 46 | 47 | Participants should have some basic knowledge of R have used R Studio before. 48 | 49 | --- 50 | 51 | # Preparations 52 | 53 | To make the most of our time, we recommend that you prepare for the workshop by installing the following software ahead of time. 54 | 55 | *Please note that these preparations will require some time to complete. Please do not delay them to the last moment before the workshop.* 56 | 57 | ### R and RStudio 58 | 59 | Please ensure that you are using a recent version of R ($\geq$ 4.0.0) and RStudio. 60 | 61 | ### LaTeX 62 | 63 | To enable `papaja`'s full set of features you need a [TeX](http://de.wikipedia.org/wiki/TeX) distribution. 64 | We recommend that you use [TinyTex](https://yihui.name/tinytex/), a LaTeX distribution designed for use with R Markdown. 65 | TinyTex can be installed from within R as follows. 66 | 67 | ```{r eval = FALSE} 68 | # If necessary, install tinytex R package 69 | if(!requireNamespace("tinytex", quietly = TRUE)) install.packages("tinytex") 70 | 71 | # Install TinyTex distribution 72 | tinytex::install_tinytex() 73 | ``` 74 | 75 | If you prefer, you may also use [MikTeX](http://miktex.org/) for Windows, [MacTeX](https://tug.org/mactex/) for Mac, or [TeX Live](http://www.tug.org/texlive/) for Linux. 76 | Refer to the [`papaja` manual](https://crsh.github.io/papaja_man/introduction.html#getting-started) for instructions. 77 | 78 | 79 | #### `papaja` 80 | 81 | `papaja` is not yet available on CRAN but you can install it from this repository: 82 | 83 | ```{r install_papapja, eval = FALSE} 84 | # Install remotes package if necessary 85 | if(!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") 86 | 87 | # Install the latest development snapshot from GitHub 88 | remotes::install_github("crsh/papaja") 89 | ``` 90 | 91 | 92 | 93 | ### Git and GitHub 94 | 95 | We will use Git for version control (change tracking) and as a tool for collaboration. 96 | The following steps may be daunting at first, but the linked-to instructions are excellent and should get you set up in no time. 97 | You can do it! :) 98 | 99 | In preparation, please 100 | 101 | 1. create a [GitHub](https://github.com) account 102 | 2. install Git (see [instructions](https://happygitwithr.com/install-git.html)) 103 | - During installation of Git, add `git bash` to the Windows context menu by selecting its option (this should be the default) 104 | 3. configure Git (see [ instructions](https://happygitwithr.com/hello-git.html)) 105 | 2. create a personal access token for HTTPS (see [instructions](https://happygitwithr.com/https-pat.html)) 106 | 4. confirm that you can connect to GitHub (see [instructions](https://happygitwithr.com/push-pull-github.html)) 107 | -------------------------------------------------------------------------------- /src/slides/1_introduction.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Reproducible research workflows for psychologists" 3 | subtitle : "Introduction" 4 | 5 | author : "
`r paste(params$author, collapse = ' & ')`" 6 | date : "`r paste0(params$location, ', ', params$date)`" 7 | --- 8 | exclude: true 9 | 10 | 11 | ```{r child = "_setup.Rmd"} 12 | 13 | ``` 14 | 15 | --- 16 | 17 | # About us 18 | 19 | [Frederik Aust](http://frederikaust.com/) ([f.aust@uva.nl](mailto:f.aust@uva.nl), [@frederikaust](http://twitter.com/frederikaust)) 20 | 21 | - PostDoc with Prof. Dr. Eric-Jan Wagenmakers at the University of Amsterdam 22 | 23 | -- 24 | - Mathematical models of learning and memory 25 | - Bayesian statistics 26 | - Computational reproducibility 27 | -- 28 | - Author and contributor to several R packages
(e.g., [`afex`](https://cran.r-project.org/web/packages/afex/index.html), [`citr`](https://cran.r-project.org/web/packages/citr/index.html), [`papaja`](https://github.com/crsh/papaja)) 29 | 30 | --- 31 | 32 | 33 | 34 | # About us 35 | 36 | [Johannes Breuer](https://www.johannesbreuer.com/) ([johannes.breuer@gesis.org](mailto:johannes.breuer@gesis.org), [@MattEagle09](https://twitter.com/MattEagle09)) 37 | 38 | - Senior researcher at [*GESIS - Leibniz Institute for the Social Sciences*](https://www.gesis.org/home) (Department Survey Data Curation) & (co-) leader of the team *Research Data & Methods* at the [*Center for Advanced Internet Studies*](https://www.cais.nrw/) (CAIS) 39 | 40 | -- 41 | - Uses and effects of digital media 42 | - Computational methods 43 | - Data management & Open science 44 | 45 | --- 46 | 47 | # About you 48 | 49 | - What's your name? 50 | - What is your research area? 51 | - What are your experiences with reproducible research (and the tools we cover in this course)? 52 | - What are your expectations for this course? 53 | 54 | --- 55 | 56 | # Preliminaries 57 | 58 | Slides and material are available at 59 | 60 | .center[ 61 | http://frederikaust.com/reproducible-research-practices-workshop 62 | ] 63 | 64 | - The workshop consists of a combination of lectures and hands-on exercises 65 | - Feel free to ask questions anytime 66 | - We will have frequent breaks (please remind us if necessary) 67 | 68 | --- 69 | 70 | # Preliminaries 71 | 72 | Did you have any trouble with the setup for this workshop? 73 | 74 | Installing... 75 | 76 | - [`git`](https://git-scm.com/) 77 | - [`R`](https://www.r-project.org/) & [*RStudio*](https://www.rstudio.com/products/rstudio/) 78 | - a `TeX` distribution (e.g., [TinyTeX](https://yihui.name/tinytex/)) 79 | - [`papaja`](https://github.com/crsh/papaja) 80 | 81 | --- 82 | 83 | # Preliminaries 84 | 85 | Did you have any trouble with the setup for this workshop? 86 | 87 | Creating... 88 | 89 | - a [*GitHub*](https://github.com/) account 90 | - an account for the [KU Leuven *GitLab*](https://gitlab.kuleuven.be/) 91 | - access credentials for *GitHub* (HTTPS, PAT) and *GitLab* (SSH) 92 | 93 | --- 94 | 95 | ## Course schedule 96 | 97 | .center[**Wednesday, April 27th, 2022**] 98 | 99 | ```{r schedule Wed, echo = F} 100 | schedule <- data.frame( 101 | "When?" = c("10:00 - 12:00", "12:00 - 13:00", "13:00 - 15:00", "15:00 - 15:30", "15:30 - 17:30") 102 | , " " = " " 103 | , "What?" = c("Introduction: Reproducible Workflows", "Lunch break", "Introduction to R Markdown", "Coffee break", "papaja") 104 | , check.names = FALSE 105 | ) 106 | knitr::kable( 107 | schedule 108 | , format = "html" 109 | , align = "ll" 110 | , escape = FALSE 111 | ) 112 | ``` 113 | 114 | --- 115 | 116 | ## Course schedule 117 | 118 | .center[**Thursday, April 28th, 2022**] 119 | 120 | ```{r schedule Thur-1, echo = F} 121 | sharing_options <- data.frame( 122 | "When?" = c("09:00 - 10:15", "10:15 - 10:30", "10:30 - 11:30", "11:30 - 12:30") 123 | , " " = " " 124 | , "What?" = c("Introduction to Git & GitHub", "Coffee break", "Git in RStudio", "Git & GitHub for collaboration - Part 1") 125 | , check.names = FALSE 126 | ) 127 | knitr::kable( 128 | sharing_options 129 | , format = "html" 130 | , align = "ll" 131 | , escape = FALSE 132 | ) 133 | ``` 134 | 135 | --- 136 | 137 | ## Course schedule 138 | 139 | .center[**Thursday, April 28th, 2022**] 140 | ```{r schedule Thur-2, echo = F} 141 | sharing_options <- data.frame( 142 | "When?" = c("12:30 - 13:30", "13:30 - 14:00", "14:00 - 14:15", "14:15 - 15:30", "15:30 - 16:00") 143 | , " " = " " 144 | , "What?" = c("Lunch break", "Git & GitHub for collaboration - Part 2", "Coffee break", "Other tools & workflows", "Wrap-Up") 145 | , check.names = FALSE 146 | ) 147 | knitr::kable( 148 | sharing_options 149 | , format = "html" 150 | , align = "ll" 151 | , escape = FALSE 152 | ) 153 | ``` 154 | 155 | --- 156 | 157 | # What is reproducibility? 158 | 159 | .center[ 160 | ```{r repro-tweet, echo=FALSE} 161 | tweetrmd::tweet_embed("https://twitter.com/jakevdp/status/519563939177197571") 162 | ``` 163 | ] 164 | 165 | --- 166 | 167 | # Why reproducibility matters 168 | 169 | 170 | .center[ 171 | ```{r repro-lazy, echo=FALSE} 172 | tweetrmd::tweet_embed("https://twitter.com/hadleywickham/status/598532170160873472") 173 | ``` 174 | ] 175 | 176 | --- 177 | 178 | # Defining reproducibility 179 | 180 | As with (almost) everything in science, there are different definitions of reproducibility. 181 | We will discuss some of them in the following. 182 | 183 | --- 184 | 185 | # Defining dimensions 186 | 187 | 3-dimensional concept space 188 | 189 | ```{r, three-dims, out.width = "50%", echo = F} 190 | include_graphics("./img/trr-cube.jpg") 191 | ``` 192 | By Christof Schöch. Source: https://dh-trier.github.io/trr/#/2/1 193 | 194 | --- 195 | 196 | # Defining dimensions 197 | 198 | ```{r, turing-dims, out.width = "75%", echo = F} 199 | include_graphics("./img/turing_way_parts.jpg") 200 | ``` 201 | [*The Turing Way Project*](https://the-turing-way.netlify.app/welcome.html) illustration by Scriberia. DOI: [10.5281/zenodo.3332807](https://doi.org/10.5281/zenodo.3332807) 202 | 203 | --- 204 | 205 | # *The Turing Way* definition 206 | 207 | ```{r, turing-def, out.width = "80%", echo = F} 208 | include_graphics("./img/reproducible-matrix.jpg") 209 | ``` 210 | Source: https://the-turing-way.netlify.app/reproducible-research/overview/overview-definitions.html 211 | 212 | --- 213 | 214 | # Replication or reproduction? 215 | 216 | ```{r, other-def, out.width = "50%", echo = F} 217 | include_graphics("./img/replication-typology-a.jpg") 218 | ``` 219 | By Christof Schöch. Source: https://dh-trier.github.io/trr/#/2/2 220 | 221 | --- 222 | exclude: true 223 | 224 | 225 | # Zooming in 226 | 227 | ```{r zoomable-plot, out.height = "95%", out.extra='id="zoom-margin"'} 228 | knitr::include_graphics("img/reproducibility-schema-1.png") 229 | ``` 230 | 231 | --- 232 | 233 | # Reproducible research workflows 234 | 235 | > being an open scientist means .highlight[adopting a few straightforward research management practices, which lead to less error-prone, reproducible research workflows] ([Klein et al., 2018](https://doi.org/10.1525/collabra.158), p. 11) 236 | 237 | --- 238 | 239 | # Research management practices 240 | 241 | There are quite a few practices that researchers can adopt to increase the reproducibility of their work. 242 | 243 | - [Project-oriented workflow](https://www.tidyverse.org/blog/2017/12/workflow-vs-script/) 244 | - [Folder structures](https://psych-transparency-guide.uni-koeln.de/folder-structure.html) 245 | - [Naming things](https://betterprogramming.pub/string-case-styles-camel-pascal-snake-and-kebab-case-981407998841?gi=3295916e039) 246 | - ... 247 | 248 | 249 | 250 | --- 251 | 252 | # Exercise: Folder structures 253 | 254 | If you feel comfortable with that, feel free to share screenshots of some of your project folders. You can choose examples that you think are particularly well-organized as well as negative examples from your "dark past" as someone whose research might have been difficult to reproduce. 255 | 256 | --- 257 | 258 | 259 | 260 | # Sharing is caring 261 | 262 | .small[ 263 | One prerequisite for research being reproducible (by others) is sharing research materials. There are many parts of their work that researchers can share to increase the reproducibility as well as the (potential) replicability of their work (see Klein et al., 2018). Four main types of output are: 264 | 265 | 1. Data 266 | 2. Code & scripts (for data collection, processing, and analysis) 267 | 3. Other study materials (e.g., questionnaires or stimulus materials) 268 | 4. (Detailed) Information about the study procedure 269 | 270 | Notably, all of these outputs should be well-documented (e.g., via README files, metadata or comments in code). 271 | ] 272 | 273 | --- 274 | 275 | # Sharing for reproducibility 276 | 277 | While sharing study materials and information about the procedure are important for replicability, for reproducibility, the most important things to share are the data and code. 278 | 279 | --- 280 | 281 | # Sharing data & code 282 | 283 | There are many different ways in which researchers can share their data and code/scripts (see Klein et al., 2018). Keeping only local copies of things and sharing upon personal request is not a very sustainable or scalable solution. The better option is sharing via institutional or public archives and repositories. 284 | 285 | --- 286 | 287 | # Fantastic repositories and where to find them `r ji("dragon")` 288 | 289 | The paper by [Klein et al. (2018)](https://doi.org/10.1525/collabra.158) provides an overview of public repositories that hold psychological data.1 290 | A good tool for finding suitable repositories is the [*Registry of Research Data Repositories*](https://www.re3data.org/). 291 | 292 | [1] However, parts of this overview have inevitably become somewhat outdated since the paper was published. 293 | 294 | 295 | --- 296 | 297 | # How to choose a repository 298 | 299 | In general, research data (and code) that are publicly archived should follow the so-called [FAIR principles](https://www.go-fair.org/fair-principles/) ([Wilkinson et al., 2016](https://doi.org/10.1038/sdata.2016.18)), meaning that the shared materials should be... 300 | 301 | - **F**indable: Persistent identifiers; metadata; indexed 302 | - **A**ccessible: Retrievable by identifier; controlled access where necessary 303 | - **I**nteroperable: Standardized metadata; open, lightweight, and interoperable file formats (e.g., CSV, TSV, JSON, ODS) 304 | - **R**eusable: Documented; clear usage license 305 | 306 | --- 307 | 308 | # How to choose a repository 309 | 310 | Some more specific key criteria for choosing a repository are that it should... 311 | 312 | - use persistent and unique identifiers (such as DOIs) 313 | - accommodate licensing 314 | - feature access controls (e.g., allowing the restriction of 315 | access to a particular set of users) 316 | - have persistence guarantees for long-term access 317 | - store data in accordance with local legislation (e.g. the [GDPR](https://gdpr.eu/) in Europe) 318 | 319 | .small[See [Klein et al., (2018)](https://doi.org/10.1525/collabra.158) for further details 320 | ] 321 | 322 | --- 323 | 324 | # Public archiving options 325 | 326 | Two archiving options that are quite popular among researchers (esp. also in psychology) are the [*Open Science Framework*](https://osf.io/) (OSF) and [*Zenodo*](https://zenodo.org/). 327 | 328 | -- 329 | 330 | While these two archives are not curated, which somewhat reduces findability, they are quite flexible and easy to use. They can be used to share different types of content, including data and code, and also offer some degree of access control. A nice feature of the *OSF* and *Zenodo*, especially for sharing code, is that they offer integration with *GitHub* (which facilitates version control). 331 | 332 | --- 333 | 334 | # Tools & tool stacks 335 | 336 | As you probably already know, there are lots of different tools and workflows that can be used to increase the reproducibility of research. These tools can then be combined into different tool stacks. We will introduce you to some of those in this workshop, but there are many more, and, in the end, it depends on your personal preferences and needs what tools/tool stacks and workflows you (should) employ.1 337 | 338 | [1] As you will see, the two of us also have different preferences in our workflows and tool use. 339 | 340 | --- 341 | 342 | # Tools in this workshop 343 | 344 | As stated before, we will focus on the following tools for reproducible research in this workshop: 345 | 346 | - Git & *GitHub*/*GitLab* 347 | - R Markdown 348 | 349 | We will focus on using them via *RStudio*. 350 | 351 | .small[ 352 | *Note:* In the outlook part, we will also briefly introduce some other/additional tools. 353 | ] 354 | 355 | --- 356 | 357 | class: center, middle 358 | 359 | # Any questions so far? 360 | -------------------------------------------------------------------------------- /src/slides/4_git_github.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Reproducible research workflows for psychologists" 3 | subtitle : "Git & GitHub" 4 | 5 | author : "
`r paste(params$author, collapse = ' & ')`" 6 | date : "`r paste0(params$location, ', ', params$date)`" 7 | --- 8 | exclude: true 9 | 10 | ```{r child = "_setup.Rmd"} 11 | 12 | ``` 13 | 14 | --- 15 | layout: true 16 | name: git 17 | 18 | # Git 19 | 20 | --- 21 | name: vc 22 | 23 | Command line tool 24 | 25 | 1. Version control 26 | - Track changes to *text files* 27 | - Retain version history of snapshot (*commits*) 28 | - Track provenance (who, what, when) 29 | 30 | --- 31 | 32 | ```{r out.width = "85%", out.extra='id="zoom-margin"'} 33 | include_graphics("img/git-history.png") 34 | ``` 35 | 36 | --- 37 | template: vc 38 | 39 | 2. Branching 40 | - Alternative versions of files 41 | - Simultaneous asynchronous collaboration 42 | 43 | -- 44 | (Vuorre & Curley, 2018) 45 | 46 | 47 | --- 48 | 49 | ```{r} 50 | include_graphics("img/git-branching.jpg") 51 | ``` 52 | 53 | 54 | --- 55 | 56 | Why use Git? 57 | 58 | - Avoid mistakes, e.g. 59 | - Working on wrong version 60 | - Inadvertently deleting or editing files 61 | -- 62 | - Track and merge changes of multiple collaborators across multiple files 63 | 64 | -- 65 | - (Offsite backups) 66 | 67 | 68 | --- 69 | layout: false 70 | class: center, middle 71 | 72 | ```{r out.height = "450px", out.width = "", echo = FALSE} 73 | knitr::include_graphics("img/git-fire.png") 74 | ``` 75 | 76 | 77 | --- 78 | layout: false 79 | name: git-system 80 | 81 | # Git 82 | 83 | ```{r out.height="", out.width="550px", echo = FALSE} 84 | knitr::include_graphics("img/git-system.png") 85 | ``` 86 | 87 | 88 | --- 89 | 90 | ```{r out.extra = "style='float:right;'", out.width = "150px"} 91 | include_graphics("img/github-logo.png") 92 | ``` 93 | 94 | # GitHub 95 | 96 | - Proprietary plattform 97 | - Free to use for academics 98 | - Host remote Git repositories 99 | -- 100 | 101 | - Provides slick web interface 102 | - Offers project management tools 103 | -- 104 | 105 | - Repositories can receive a DOI with [Zenodo](https://guides.github.com/activities/citable-code/) 106 | -- 107 | 108 | - Servers located in the USA (GDPR) 109 | 110 | 111 | --- 112 | 113 | # GitHub 114 | 115 | 116 | 117 | ```{r out.height="450px", out.width="", echo = FALSE} 118 | knitr::include_graphics("img/github-home.png") 119 | ``` 120 | 121 | 122 | --- 123 | layout:false 124 | 125 | ```{r out.height="600px", out.width="", echo = FALSE} 126 | knitr::include_graphics("img/github-new-repo.png") 127 | ``` 128 | 129 | 130 | --- 131 | 132 | ```{r out.extra = "style='float:right;'", out.width = "150px"} 133 | include_graphics("img/gitlab-logo.png") 134 | ``` 135 | 136 | # GitLab 137 | 138 | - .highlight[Open source plattform] 139 | - .highlight[Can be hosted by your institution] 140 | -- 141 | 142 | - Host remote Git repositories 143 | - Provides slick web interface 144 | - Offers project management tools 145 | -- 146 | 147 | - .highlight[Servers can be located in your country] (GDPR) 148 | 149 | --- 150 | 151 | # GitLab 152 | 153 | 154 | 155 | ```{r echo = FALSE} 156 | knitr::include_graphics("img/gitlab-home.png") 157 | ``` 158 | 159 | 160 | --- 161 | layout: false 162 | 163 | ```{r out.height="600px", out.width="", echo = FALSE} 164 | knitr::include_graphics("img/gitlab-new-repo.png") 165 | ``` 166 | 167 | 168 | --- 169 | layout: true 170 | template: git 171 | 172 | --- 173 | 174 | Clone your GitHub repository to your computer 175 | 176 | ~~~bash 177 | git clone git@github.com:crsh/my-first-repository.git` 178 | ~~~ 179 | 180 | .pull-left-45[ 181 | 182 | ```{r out.height="", out.width="450px", echo = FALSE} 183 | knitr::include_graphics("img/github-clone.png") 184 | ``` 185 | 186 | ] 187 | 188 | .pull-right-45[ 189 | 190 | ```{r out.height="", out.width="450px", echo = FALSE} 191 | knitr::include_graphics("img/rstudio-new-git.png") 192 | ``` 193 | 194 | ] 195 | 196 | 197 | --- 198 | 199 | .pull-left-50[ 200 | 201 | `.gitignore` 202 | 203 | - Files to ignore (do not track) 204 | - Each line specifies a [pattern](https://git-scm.com/docs/gitignore) 205 | - I typically add R Markdown cache files
(e.g., `.rdb`, `.rdx`) 206 | - `usethis:::git_ignore_lines` 207 | 208 | ] 209 | 210 | .pull-right-40[ 211 | 212 | ![](img/gitignore.png) 213 | 214 | ] 215 | 216 | 217 | --- 218 | **Adding files** 219 | 220 | ~~~bash 221 | git status # What has changed? 222 | git add . # Stage all changes 223 | git commit -m "My very first commit! :)" 224 | ~~~ 225 | 226 | .pull-left-45[ 227 | 228 | - New files are "untracked", not watched for changes 229 | - To start tracking "stage" and "commit" files 230 | 231 | ] 232 | 233 | .pull-right-55[ 234 | 235 | ```{r out.height="", out.width="80%", echo = FALSE} 236 | knitr::include_graphics("img/rstudio-git-commit.png") 237 | ``` 238 | 239 | ] 240 | 241 | ??? 242 | Amend a previous commit if you forgot to add a change 243 | 244 | --- 245 | template: git-system 246 | 247 | 248 | --- 249 | 250 | Now we can push changes to our remote repository 251 | 252 | ~~~bash 253 | git push 254 | ~~~ 255 | 256 | ```{r out.height="", out.width="700px", echo = FALSE} 257 | knitr::include_graphics("img/rstudio-git-pushed.png") 258 | ``` 259 | 260 | -- 261 | 262 | ~~~bash 263 | git pull 264 | ~~~ 265 | 266 | 267 | --- 268 | 269 | ~~~bash 270 | git log 271 | ~~~ 272 | 273 | ```{r out.height="450px", out.width="", echo = FALSE} 274 | knitr::include_graphics("img/rstudio-git-history.png") 275 | ``` 276 | 277 | 278 | --- 279 | **Standard Git workflow** 280 | 281 | 282 | ~~~bash 283 | git pull 284 | git status 285 | git add . 286 | git commit -m "Such exciting changes! :)" 287 | git log 288 | git push 289 | ~~~ 290 | 291 | --- 292 | 293 | GitHub provides a web interface for your repository 294 | 295 | - List of files 296 | - Overview of commit history 297 | 298 | ```{r out.height="", out.width="700px", echo = FALSE} 299 | knitr::include_graphics("img/github-commit.png") 300 | ``` 301 | 302 | 303 | --- 304 | layout: false 305 | class: middle, center 306 | 307 | # Exercise time 308 | 309 | .center[[Exercise](http://frederikaust.com/reproducible-research-practices-workshop/exercises/4_git_github_question.html)] 310 | 311 | .center[[Solutions](http://frederikaust.com/reproducible-research-practices-workshop/exercises/4_git_github_solution.html)] 312 | -------------------------------------------------------------------------------- /src/slides/5_Git&RStudio.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Reproducible research workflows for psychologists" 3 | subtitle : "Git & RStudio" 4 | 5 | author : "
`r paste(params$author, collapse = ' & ')`" 6 | date : "`r paste0(params$location, ', ', params$date)`" 7 | --- 8 | exclude: true 9 | 10 | ```{r child = "_setup.Rmd"} 11 | 12 | ``` 13 | 14 | --- 15 | 16 | # Interacting with `Git` 17 | 18 | There are various tools that we can use for interacting with `Git`. Besides command line interfaces (CLI), such as [*git bash*](https://gitforwindows.org/) for *Windows* or the Terminal on *MacOS*, there also are Graphical User Interfaces (GUI), such as [*GitHub Desktop*](https://desktop.github.com/) or [*GitKraken*](https://www.gitkraken.com/) (for an overview of `Git` clients with a GUI, see https://git-scm.com/downloads/guis). 19 | 20 | --- 21 | 22 | # A note on tool stacks 23 | 24 | While we introduce you to different tools for reproducible research in this workshop and it is always possible to "mix and match", it is usually advisable to try to minimize the number of different tools in your workflow. 25 | 26 | --- 27 | 28 | # VC in your favorite IDE 29 | 30 | Lucky for us, the most popular Integrated Development Interfaces (IDE) for `R`, *RStudio*, also offers functionalities for using `Git`.1 31 | 32 | 33 | [1] Another popular IDE that works nicely with `R` and `Git` is [*Visual Studio Code*](https://code.visualstudio.com/) - or VSCode for short - by *Microsoft*. 34 | 35 | --- 36 | 37 | # All set? 38 | 39 | If you have correctly set up `Git`, *RStudio* should be able to detect it. The easiest way to check this is via the *RStudio* options: *Tools* -> *Global Options* -> *Git/SVN* 40 | 41 | ```{r git-menu, out.width = "45%", echo=FALSE} 42 | include_graphics("./img/git_menu.png") 43 | ``` 44 | 45 | --- 46 | 47 | # Finding `Git` 48 | 49 | If you have properly installed `Git` and *RStudio* cannot detect your local `Git` executable, you need to tell it where to find it via the *Browse* button in the menu shown on the previous slide. 50 | 51 | On macOS and Linux, a common path for the `Git` installation is (something like) `/usr/bin/git`, while on Windows it is (something like) `C:/Program Files/Git/bin/git.exe`. 52 | 53 | *Note*: You should restart *RStudio* after making changes in this menu. 54 | 55 | --- 56 | 57 | # How to use `Git` in *RStudio* 58 | 59 | There are essentially two options for using `Git` via *RStudio* 60 | 61 | 1. Through the GUI 62 | 63 | 2. Via the Terminal 64 | 65 | --- 66 | 67 | # Other options for using `Git` with `R` 68 | 69 | .small[ 70 | While we won't cover those in any detail in this session, there are also *R* packages for `Git` operations: 71 | - [`usethis`](https://usethis.r-lib.org/) can, e.g., be used to initialize a `Git` repository or for managing credentials 72 | - [`gert`](https://docs.ropensci.org/gert/) is a simple `Git` client for `R` that can be used to perform basic `Git` commands, such as staging, adding, and committing files, or creating, merging, and deleting branches 73 | - [`ghstudio`](https://github.com/moodymudskipper/ghstudio) is a novel in-development package that provides "experimental tools to use git/github with RStudio, e.g see issues and diffs in the viewer" 74 | ] 75 | 76 | --- 77 | 78 | # Are you legit to `Git`? 79 | 80 | As a reminder, there are two protocols for securely communicating with remote `Git` servers, such as *GitHub*: `HTTPS` and `SSH`. 81 | 82 | For our *GitHub* examples, we will use `HTTPS` with a Personal Access Token (PAT). For the *KU Leuven GitLab*, we will use `SSH`. 83 | 84 | --- 85 | 86 | # Creating a PAT 87 | 88 | You should have created a PAT in preparation for this course (via the *GitHub* web interface. If you have not yet done so, you can also use a function from the `usethis` package. 89 | 90 | ```{r create-gh-token, eval = FALSE} 91 | library(usethis) 92 | 93 | create_github_token() 94 | ``` 95 | 96 | **NB**: Do not close the browser window/tab with the PAT until you have stored it somewhere. You should treat the PAT like a password. 97 | 98 | --- 99 | 100 | # Storing a PAT 101 | 102 | Once you have created a PAT, the simplest way to store it for use with `R` and *RStudio* is the `gitcreds_set()` function from the [`gitcreds` package](https://gitcreds.r-lib.org/). 103 | 104 | ```{r store-pat, eval = FALSE} 105 | library(gitcreds) 106 | 107 | gitcreds_set() 108 | ``` 109 | 110 | *Note*: Of course, you can also (or additionally) store your PAT in another (safe) place, such as your password manager. 111 | 112 | --- 113 | 114 | # SSH 115 | 116 | SSH stands for Secure Shell and is another option for secure interaction with remote `Git` servers, such as *GitHub* or *GitLab* instances. As for the PAT, you should have set up SSH in preparation for the workshop. If you have done so, the location of your RSA key should be displayed in the *RStudio* `Git` menu (*Tools* -> *Global Options* -> *Git/SVN*). 117 | 118 | --- 119 | 120 | # SSH 121 | 122 | ```{r rstudio-ssh, out.width = "70%", echo=FALSE} 123 | include_graphics("./img/git_menu_rstudio.png") 124 | ``` 125 | 126 | --- 127 | 128 | # SSH 129 | 130 | If you have not done so before, you first need to create an RSA key via the `Git` menu in *RStudio*. After that, you have to need to copy the public key into the key field in the SSH Keys page on *GitLab*. 131 | 132 | ```{r gitlab-ssh, out.width = "85%", echo=FALSE} 133 | include_graphics("./img/ssh_key_gitlab.png") 134 | ``` 135 | 136 | --- 137 | 138 | # `Git` + *RStudio* = `r ji("heart")` 139 | 140 | Now you should hopefully be all set to use `Git` as well *GitHub* and *GitLab* via *RStudio*. 141 | 142 | In order to get the best out of the combination of `R`, `R Markdown`, *RStudio*, and `Git`, it is recommendable to adopt a ["project-oriented workflow"](https://rstats.wtf/project-oriented-workflow.html). 143 | 144 | --- 145 | 146 | # Excursus: *RStudio* projects 147 | 148 | *RStudio* projects are associated with `.Rproj` files that contain some specific settings for the project. If you double-click on a `.Rproj` file, this opens a new instance of *RStudio* with the working directory and file browser set to the location of that file. 149 | 150 | *Note*: The repository/folder for this workshop contains an `.Rproj` file, if you want to try this out. 151 | 152 | --- 153 | 154 | # Excursus: *RStudio* projects 155 | 156 | Using *RStudio* projects can facilitate several things: the organization of files, the use of (relative) file paths, but also the integration of `R` and `R Markdown` with `Git`. 157 | 158 | -- 159 | 160 | Explaining *RStudio* projects in detail would be too much of a detour at this point, but if your interested in that, you can check out the [*RStudio* support site](https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects) or the [respective chapter in *What They Forgot to Teach You About R*](https://rstats.wtf/project-oriented-workflow.html#rstudio-projectsl). 161 | 162 | --- 163 | 164 | # What comes first? `r ji("chicken")` `r ji("egg")` 165 | 166 | In your everyday work, you quite likely need different workflows depending on the temporal order in which things are created or set up: your local project/files, version control with `Git`, and the remote *GitHub* repository. 167 | 168 | - [New project, GitHub first](https://happygitwithr.com/new-github-first.html) 169 | - [Existing project, GitHub first](https://happygitwithr.com/existing-github-first.html) 170 | - [Existing project, GitHub last](https://happygitwithr.com/existing-github-last.html) 171 | 172 | -- 173 | 174 | In this session, we will focus on the *New project, GitHub first* approach (which works the same for *GitLab*). 175 | 176 | --- 177 | 178 | # `Git` through the GUI 179 | 180 | You can perform quite a few `Git` operations via the *RStudio* GUI: You can, e.g., create a new `Git` repository, clone an existing repository, stage and commit changes and push them to a remote repository, or pull changes from there, and merge those with your local changes. 181 | 182 | We'll go through a few of these common steps in the following. 183 | 184 | --- 185 | 186 | # New `Git` project connected to existing remote repo 187 | 188 | You can create a new version-controlled project that is connected to a remote repository that already exists on *GitHub* or *GitLab* via *File* -> *New Project* -> *Version Control* in the *RStudio* menu. 189 | 190 | ```{r vc-proj, out.width = "45%", echo=FALSE} 191 | include_graphics("./img/vc_project.png") 192 | ``` 193 | 194 | --- 195 | 196 | # New `Git` project connected to existing remote repo 197 | 198 | Next, choose `Git`... 199 | 200 | ```{r git-proj, out.width = "65%", echo=FALSE} 201 | include_graphics("./img/choose_git.png") 202 | ``` 203 | 204 | --- 205 | 206 | # Associate remote repo: `HTTPS` 207 | 208 | In the menu that opens after that, enter the URL of the remote repository, give the local repository a name, and tell *RStudio* where it should be stored. It usually makes sense to check "Open in new session". 209 | 210 | -- 211 | 212 | **NB**: Which URL you should enter depends on the authentication method you use. If you use `HTTPS`, you can simply copy the URL from the address bar of your browser. 213 | 214 | --- 215 | 216 | # Associate remote repo: `HTTPS` 217 | 218 | ```{r gh-clone-https, out.width = "75%", echo=FALSE} 219 | include_graphics("./img/git_clone_https.png") 220 | ``` 221 | 222 | --- 223 | 224 | # URL for `SSH` 225 | 226 | In case you use `SSH`, you can get the right URL from *GitLab* via the blue *Clone* button on the website of the repository. 227 | 228 | ```{r gl-ssh, out.width = "95%", echo=FALSE} 229 | include_graphics("./img/gl_ssh.png") 230 | ``` 231 | 232 | --- 233 | 234 | # Associate remote repo: `SSH` 235 | 236 | ```{r gl-clone-ssh, out.width = "75%", echo=FALSE} 237 | include_graphics("./img/git_clone_ssh.png") 238 | ``` 239 | 240 | --- 241 | 242 | # Modifying & creating files within the project 243 | 244 | Once you have successfully created the project, you can start editing files or creating new ones. When you have modified existing files and/or created new ones and saved the changes, these will be displayed in the `Git` tab in *RStudio* and their status will be indicated as *modified* or *untracked*. 245 | 246 | *Note*: The `Git` tab also displays in which branch you are currently working. 247 | 248 | --- 249 | 250 | # Modifying & creating files within the project 251 | 252 | ```{r files-changed, out.width = "75%", echo=FALSE} 253 | include_graphics("./img/git_pane_files_changed.png") 254 | ``` 255 | 256 | --- 257 | 258 | # Staging changes 259 | 260 | Once you have reached a point at which you want to commit (and possibly also push) your changes, you can stage them by checking the boxes in the *Staged* column in the `Git` tab. This the *RStudio* GUI equivalent of `git add`. The status of previously untracked files will then change to *added*. 261 | 262 | ```{r staged, out.width = "65%", echo=FALSE} 263 | include_graphics("./img/git_staged.png") 264 | ``` 265 | 266 | --- 267 | 268 | # Committing & pushing changes 269 | 270 | After staging your changes you can commit them via the *Commit* button in the `Git` tab. In the commit menu that opens you should enter a meaningful commit message. Once that is done you can click the *Commit* button. If you want to, you can also directly push your changes to the remote repository on *GitHub* via the *Push* button. You can, of course, also do this at a later point (directly via the `Git` tab). 271 | 272 | 273 | --- 274 | 275 | # Committing & pushing changes 276 | 277 | ```{r commit, out.width = "85%", echo=FALSE} 278 | include_graphics("./img/git_commit.png") 279 | ``` 280 | 281 | --- 282 | 283 | # Pulling changes from the remote repository 284 | 285 | You can also pull changes from the remote repository via the *Pull* button in the `Git` tab. 286 | 287 | As a general workflow recommendation (especially if you're just getting started with `Git` and *GitHub*/*GitLab*) it is usually advisable to first pull from the remote repository before making (and then staging, committing, and pushing) any local changes. This is even more relevant when you collaborate with others on the same repository (more on that later). 288 | 289 | --- 290 | 291 | # Pulling changes from the remote repository 292 | 293 | **Important technical note**: If you click the *Pull* button in *RStudio* this will perform a [pull with rebase](http://gitready.com/advanced/2009/02/11/pull-with-rebase.html). Put briefly, pulling with rebase means that local changes are reapplied on top of remote changes. This is [different from pull with merge](https://sdqweb.ipd.kit.edu/wiki/Git_pull_--rebase_vs._--merge). In many scenarios, this is generally the preferable method and nothing you need to worry about. However, in some cases, this can cause issues, and it is good to be aware of this. 294 | 295 | --- 296 | 297 | # Limitations of the GUI 298 | 299 | While the *RStudio* GUI can be used for quite a few basic `Git` operations, it has a set of limitations. The first one is the use of specific defaults as is the case with pulling (with rebase). Another one is that it can become quite tedious to stage a large number of files through the GUI. 300 | 301 | --- 302 | 303 | # Limitations of the GUI 304 | 305 | Another downside of interacting with `Git` through the *RStudio* GUI is that there is a risk of *RStudio* becoming really slow or even crashing if you add/commit a lot of files at the same time and/or very large files. If the overall size of added or altered files is large, the Commit menu in *RStudio* usually also gives a warning about this. 306 | 307 | The *RStudio* GUI is also not the best tool for [handling merge conflicts](https://happygitwithr.com/git-branches.html?q=merge%20conflict#dealing-with-conflicts) (we will discuss those in more detail when we talk about *Git* & collaboration). 308 | 309 | 310 | --- 311 | 312 | # Destination `Terminal` 313 | 314 | If you want to add/commit a lot of files or large files, want more control over the `Git` commands, or need to use more advanced `Git` operations, the *RStudio* GUI is not the right choice. Instead, you should use a command line interface (CLI). 315 | 316 | --- 317 | 318 | # Destination `Terminal` 319 | 320 | Lucky for us, if you need a CLI for using `Git`, you don't need to leave *RStudio*. As of version 1.3.1056-1, *RStudio* provides a `Terminal` tab in the console pane. Through this, *RStudio* provides access to the [system shell](https://happygitwithr.com/shell.html). If you have properly installed `Git` you can use this to execute the full range of `Git` commands. 321 | 322 | --- 323 | 324 | # Picking shells `r ji("shell")` 325 | 326 | Depending on your OS as well as your installation of `Git`, you can pick different shells to be run in the *RStudio* Terminal tab. You can choose those via the the *Terminal* menu in the *RStudio* Global Options. 327 | 328 | ```{r terminal-menu, out.width = "45%", echo=FALSE} 329 | include_graphics("./img/terminal_menu.png") 330 | ``` 331 | 332 | --- 333 | 334 | # Picking shells `r ji("shell")` 335 | 336 | If you use *Windows* and have installed `Git` for *Windows*, you should use `Git Bash` as the shell that is run in the *RStudio* terminal (shown in the picture below). On *MacOS*, you should be able to simply use its own `Terminal` in *RStudio*. 337 | 338 | ```{r terminal, out.width = "80%", echo=FALSE} 339 | include_graphics("./img/terminal.png") 340 | ``` 341 | 342 | --- 343 | 344 | # Terminal and Shell in *RStudio* 345 | 346 | For some more information on choosing and using the shell in *RStudio*, you can check out the [chapter on this in *Happy Git and GitHub for the useR*](https://happygitwithr.com/shell.html) or the *RStudio* How To Article on [*Using the RStudio Terminal in the RStudio IDE*](https://support.rstudio.com/hc/en-us/articles/115010737148-Using-the-RStudio-Terminal-in-the-RStudio-IDE). 347 | 348 | --- 349 | 350 | # Using the `Terminal` in *RStudio* 351 | 352 | You can use the `Terminal` in *RStudio* to run all available `Git` commands, such as `git status`. 353 | 354 | ```{r git-status, out.width = "80%", echo=FALSE} 355 | include_graphics("./img/git-status.png") 356 | ``` 357 | 358 | --- 359 | 360 | # Using the `Terminal` in *RStudio* 361 | 362 | You can also use the full range of arguments to customize your `Git` commands. For example, to stage and commit all changes, you could run the following command in the `Terminal`: `git add -A && git commit -m "Your Message"` 363 | 364 | --- 365 | 366 | class: center, middle 367 | 368 | # [Exercise](https://crsh.github.io/reproducible-research-practices-workshop/exercises/5_git-rstudio_question.html) time `r ji("weight_lifting_woman")``r ji("muscle")``r ji("running_man")``r ji("biking_man")` 369 | 370 | ## [Solutions](https://crsh.github.io/reproducible-research-practices-workshop/exercises/5_git-rstudio_solution.html) 371 | 372 | --- 373 | 374 | # Resources 375 | 376 | A really great resource on using `Git` (and *GitHub*) in combination with `R` and *RStudio* is the website [*Happy Git and GitHub for the useR*](https://happygitwithr.com/) by [Jennifer Bryan](https://jennybryan.org/). Much of the content in this session is based on this resource and it offers a lot of additional helpful information and advice (including some help with troubleshooting commonly encountered issues). 377 | 378 | Another good introductory resource is the *RStudio* How-To Article on [*Version Control with Git and SVN*](https://support.rstudio.com/hc/en-us/articles/200532077?version=2021.09.0%2B351&mode=desktop). 379 | 380 | -------------------------------------------------------------------------------- /src/slides/6_github_collaboration.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Reproducible research workflows for psychologists" 3 | subtitle : "Collaborate with Git & GitHub" 4 | 5 | author : "
`r paste(params$author, collapse = ' & ')`" 6 | date : "`r paste0(params$location, ', ', params$date)`" 7 | --- 8 | exclude: true 9 | 10 | ```{r child = "_setup.Rmd"} 11 | 12 | ``` 13 | 14 | 15 | --- 16 | layout: false 17 | name: git-system 18 | 19 | # Git 20 | 21 | ```{r out.height="", out.width="550px", echo = FALSE} 22 | knitr::include_graphics("img/git-system.png") 23 | ``` 24 | 25 | --- 26 | layout: true 27 | name: collabo 28 | 29 | # Collaboration 30 | 31 | --- 32 | 33 | **Add collaborators** 34 | 35 | .center[ 36 | `Settings > Manage access > Add people` 37 | ] 38 | 39 | ```{r out.height="", out.width="700px", echo = FALSE} 40 | knitr::include_graphics("img/github-add-collaborator.png") 41 | ``` 42 | 43 | --- 44 | 45 | **Add collaborators** 46 | 47 | .center[ 48 | `Project information > Members > Invite members` 49 | ] 50 | 51 | ```{r out.height="", out.width="600px", echo = FALSE} 52 | knitr::include_graphics("img/gitlab-add-collaborator.png") 53 | ``` 54 | 55 | --- 56 | 57 | GitHub provides a lot of collaboration features 58 | 59 | - Edit files in browser 60 | - Change highlighting and commenting 61 | - Interactive revise-and-resubmit workflow 62 | - [See example](https://github.com/crsh/papaja/pull/443) 63 | - Issue tracker (to-do list and discussion) 64 | - ... 65 | 66 | 67 | ??? 68 | - Rich change view 69 | - Comments on commits 70 | - GitHub workflow is used by JOSS 71 | 72 | Show git blame ;) 73 | 74 | --- 75 | 76 | Workflows for collaboration 77 | 78 | 1. "Publishing" changes without prior review 79 | - Push directly to `main` branch on GitHub 80 | -- 81 | 2. Suggest changes with review (*pull request*) 82 | - Create a new *branch* ("parallel universe" of repository) 83 | -- 84 | 85 | Edit on GitHub or in RStudio on your computer 86 | 87 | --- 88 | layout: false 89 | 90 | # Pull requests 91 | 92 | ```{r out.height="", out.width="500px", echo = FALSE} 93 | knitr::include_graphics("img/github-workflow.png") 94 | ``` 95 | 96 | 1. Pull current state of repository 97 | 2. Create new _branch_ ("parallel universe") 98 | 3. Make changes, stage, commit, & push 99 | 4. Discuss and revise changes 100 | 5. Merge changes 101 | 102 | 103 | --- 104 | layout: true 105 | 106 | # Editing on GitHub 107 | 108 | --- 109 | 110 | Small changes (to one file) in the browser on GitHub 111 | 112 | ```{r out.height="", out.width="700px", echo = FALSE} 113 | knitr::include_graphics("img/github-edit.png") 114 | ``` 115 | 116 | --- 117 | 118 | ```{r out.height="", out.width="700px", echo = FALSE} 119 | knitr::include_graphics("img/github-edit-pr.png") 120 | ``` 121 | 122 | 123 | --- 124 | 125 | ```{r out.height="", out.width="700px", echo = FALSE} 126 | knitr::include_graphics("img/github-open-pr.png") 127 | ``` 128 | 129 | 130 | ??? 131 | - Request reviewer 132 | 133 | 134 | --- 135 | name: review 136 | 137 | Reviewers can provide 138 | 139 | - comments on specific changes 140 | 141 | --- 142 | template: review 143 | 144 | ```{r out.height="", out.width="700px", echo = FALSE} 145 | knitr::include_graphics("img/github-inline-comment.png") 146 | ``` 147 | 148 | --- 149 | template: review 150 | 151 | - higher level comments on the entire pull request 152 | 153 | ```{r out.height="", out.width="650px", echo = FALSE} 154 | knitr::include_graphics("img/github-pr-review.png") 155 | ``` 156 | 157 | 158 | ??? 159 | Show how to make additional changes after review 160 | 161 | https://github.com/crsh/my-first-repository/pull/1 162 | 163 | 164 | --- 165 | layout: true 166 | template: footer 167 | 168 | # Editing on your computer 169 | 170 | --- 171 | 172 | Larger changes across multiple files in RStudio 173 | 174 | 1. Pull current state of remote repository 175 | 2. Switch to new _branch_ ("parallel universe") 176 | 3. Make changes, stage, commit, & push 177 | 178 | .pull-left-45[ 179 | 180 | ~~~bash 181 | git pull 182 | *git branch revision 183 | *git checkout revision 184 | git status 185 | git add . 186 | git commit -m "My changes" 187 | ... 188 | *git push origin revision 189 | ~~~ 190 | 191 | ] 192 | 193 | .pull-right-45[ 194 | 195 | ```{r out.height="", out.width="100%", echo = FALSE} 196 | knitr::include_graphics("img/rstudio-branches.png") 197 | ``` 198 | 199 | ] 200 | 201 | --- 202 | 203 | ```{r out.height="", out.width="100%", echo = FALSE} 204 | knitr::include_graphics("img/github-pr-branch.png") 205 | ``` 206 | 207 | 208 | --- 209 | 210 | ```{r out.height="", out.width="100%", echo = FALSE} 211 | knitr::include_graphics("img/github-pr-branch2.png") 212 | ``` 213 | 214 | --- 215 | layout: true 216 | 217 | # Merge conflicts `r ji("scream")` 218 | 219 | --- 220 | 221 | Competing changes to *the same line of text* 222 | 223 | ```{r out.height="", out.width="100%", echo = FALSE} 224 | knitr::include_graphics("img/github-merge-conflict.png") 225 | ``` 226 | 227 | --- 228 | 229 | Review competing changes marked by `<<<<<<<<` and `>>>>>>>>` 230 | 231 | ```{r out.height="", out.width="100%", echo = FALSE} 232 | knitr::include_graphics("img/github-merge-conflict-edit.png") 233 | ``` 234 | 235 | -- 236 | 237 | Again, this can be done on GitHub or in RStudio 238 | 239 | --- 240 | 241 | Stage and commit conflict resolution 242 | 243 | ```{r out.height="", out.width="100%", echo = FALSE} 244 | knitr::include_graphics("img/github-merge-conflict-resolve.png") 245 | ``` 246 | 247 | ~~~bash 248 | git add . 249 | git commit -m "Resolved merge conflict by doing something" 250 | 251 | ~~~ 252 | 253 | --- 254 | layout: false 255 | class: middle, center 256 | 257 | # Exercise time 258 | 259 | .center[[Exercise](http://frederikaust.com/reproducible-research-practices-workshop/exercises/6_github_collaboration_question.html)] 260 | 261 | .center[[Solutions](http://frederikaust.com/reproducible-research-practices-workshop/exercises/6_github_collaboration_solution.html)] 262 | -------------------------------------------------------------------------------- /src/slides/7_Other_Topics.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "Reproducible research workflows for psychologists" 3 | subtitle : "Other topics in reproducible research" 4 | 5 | author : "
`r paste(params$author, collapse = ' & ')`" 6 | date : "`r paste0(params$location, ', ', params$date)`" 7 | --- 8 | exclude: true 9 | 10 | ```{r child = "_setup.Rmd"} 11 | ``` 12 | 13 | --- 14 | 15 | # Other topics in reproducible research 16 | 17 | .small[ 18 | As we said in the introduction, we cannot cover all tools and topics related to reproducible research in this workshop. However, we want to use this session to cover some additional tools as well as other topics in reproducible research: 19 | 20 | - Collaborating with others who do not use `R Markdown` and/or `Git` 21 | - R package dependency management 22 | - Preventing code rot 23 | - Publishing reproducible research environments and "one-click reproducibility" 24 | ] 25 | 26 | --- 27 | 28 | # Other approaches to collaboration 29 | 30 | There also are `R` packages that you can use for collaborating on `R Markdown` documents with people who do not (want to) use `R Markdown` (and `Git`): 31 | 32 | - [`trackdown`](https://claudiozandonella.github.io/trackdown/) uses *Google Drive* for this 33 | 34 | - [`redoc`](https://noamross.github.io/redoc/) "is a package to enable a two-way R Markdown-Microsoft Word workflow" (*note*: development currently suspended) 35 | 36 | --- 37 | 38 | # `trackdown` 39 | 40 | The basic workflow for `trackdown` is that you upload the content of an `.Rmd` file to *Google Drive* where you can collaboratively edit the text parts. You can then download the document again (e.g., to edit the code in the `R Markdown` document in *RStudio*), and also update the file on *Google Drive* after changing the `.Rmd` locally. The [`trackdown` documentation](https://claudiozandonella.github.io/trackdown/) provides further details. 41 | 42 | --- 43 | 44 | # Advanced use of `trackdown` with `Git` 45 | 46 | To combine `R Markdown` with collaborative text editing via `trackdown` and version control (and to avoid potential issues caused by - possibly unintended - changes to the code parts on *Google Drive*), the author of the `trackdown` package, [Claudio Zandonella Callegher](https://github.com/ClaudioZandonella), proposes a solution in an [issue in the *GitHub* repository for the package](https://github.com/ClaudioZandonella/trackdown/issues/31). 47 | 48 | Essentially, the idea here is to create a `trackdown` branch in the `Git` repository and merge it with the `main` branch which is (mainly) used to edit the code. 49 | 50 | 51 | 52 | 53 | --- 54 | layout: true 55 | template: footer 56 | 57 | # Dependency management 58 | 59 | 60 | --- 61 | 62 | ```{r zoomable-plot, out.width = "75%", out.extra='id="zoom-margin"'} 63 | include_graphics("img/dependendy-graph.png") 64 | ``` 65 | 66 | --- 67 | 68 | - Our projects may use/require different package versions 69 | - Manually managing dependencies is a nightmare 70 | - Keeping track of the dependencies and their changes 71 | - Restore the R environment 72 | 73 | --- 74 | 75 | 1. [`checkpoint`](https://github.com/RevolutionAnalytics/checkpoint/) by Microsoft 76 | - Requires a project-based workflow 77 | - Package database will gradually grow 78 | -- 79 | 80 | 2. [`groundhog`](https://groundhogr.com/) 81 | - Package database will gradually grow 82 | -- 83 | 84 | 3. [`renv`](https://rstudio.github.io/renv/articles/renv.html) by RStudio 85 | - Most flexible and powerful 86 | - Least straight forward to use 87 | - No "forensic" applications 88 | 89 | --- 90 | 91 | ```{r} 92 | include_graphics("img/checkpoint-pkg.png") 93 | ``` 94 | 95 | 96 | --- 97 | 98 | Dependencies are detected automatically 99 | 100 | ```{r echo = TRUE, eval = FALSE} 101 | library("checkpoint") 102 | checkpoint("2022-04-27") 103 | 104 | library("ggplot2") 105 | ``` 106 | 107 | -- 108 | 109 | Uses a date-specific directory outside of usual library 110 | 111 | ```bash 112 | ~/.checkpoint/... 113 | ``` 114 | 115 | --- 116 | layout: true 117 | template: footer 118 | 119 | # Code rot 120 | 121 | --- 122 | name: toppling 123 | 124 | .pull-left-75[ 125 | 126 | ```{r echo = FALSE, fig.align = "center", out.height = "475px", out.width = ""} 127 | knitr::include_graphics("img/toppling-tower.jpg") 128 | ``` 129 | 130 | ] 131 | 132 | --- 133 | template: toppling 134 | 135 | .pull-right-25[ 136 |

137 | `r ji("white_check_mark")` 138 | ] 139 | 140 | 141 | --- 142 | - We need to archive the computing environment 143 | 144 | -- 145 | - But how? 146 | 147 | -- 148 | - Lock away computer used to run the analysis? 149 | - Trade-off between robustness and feasibility 150 | 151 | -- 152 | 153 |
154 | 155 | ```{r echo = TRUE, eval = FALSE} 156 | checkpoint("2020-01-01", r_version = "3.6.2") 157 | ``` 158 | 159 | --- 160 | template: toppling 161 | 162 | .pull-right-25[ 163 |

164 | `r ji("white_check_mark")` 165 |

166 | (`r ji("white_check_mark")`) 167 | ] 168 | 169 | 170 | --- 171 | 172 | ### Virtual machines 173 | 174 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "450px"} 175 | knitr::include_graphics("img/vm-stack.png") 176 | ``` 177 | 178 | .center[ 179 | (Piccolo & Frampton, 2016) 180 | ] 181 | 182 | 183 | --- 184 | 185 | ### Containers 186 | 187 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "450px"} 188 | knitr::include_graphics("img/container-stack.png") 189 | ``` 190 | 191 | .center[ 192 | (Piccolo & Frampton, 2016) 193 | ] 194 | 195 | 196 | --- 197 | template: toppling 198 | 199 | .pull-right-25[ 200 |

201 | `r ji("white_check_mark")` 202 |

203 | `r ji("white_check_mark")` 204 |

205 | `r ji("white_check_mark")` 206 | ] 207 | 208 | 209 | --- 210 | layout: false 211 | 212 | # Docker 213 | 214 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "450px"} 215 | knitr::include_graphics("img/docker-logo.png") 216 | ``` 217 | 218 | 219 | --- 220 | layout: true 221 | 222 | # Docker: Kind of like Hermann 223 | 224 | 225 | > Herman cake (often called Herman) is a 'friendship cake'. [...] the starter is passed from person to person (like a chain letter) and continues to grow as it contains yeast and lactic acid bacteria. One starter can, in theory, last indefinitely. ([Wikipedia](https://en.wikipedia.org/wiki/Herman_cake)) 226 | 227 | 228 | --- 229 | 230 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "700px"} 231 | knitr::include_graphics("img/hermann.png") 232 | ``` 233 | 234 | 235 | --- 236 | 237 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "700px"} 238 | knitr::include_graphics("img/hermann-docker.png") 239 | ``` 240 | 241 | 242 | --- 243 | layout: true 244 | 245 | # Docker 246 | 247 | --- 248 | 249 | Built on a prepackaged base images from DockerHub (["rocker"](https://github.com/rocker-org/rocker#versioned-stack-builds-on-r-ver)) 250 | 251 | ```{r echo = FALSE, fig.align = "center", out.height = "", out.width = "450px"} 252 | knitr::include_graphics("img/rocker-images.png") 253 | ``` 254 | 255 | --- 256 | 257 | **Simplified Docker example** 258 | 259 | -- 260 | 261 | ~~~Dockerfile 262 | # Select base image 263 | FROM rocker/rstudio:4.1.2 264 | ~~~ 265 | 266 | - Latest Debian version 267 | - R 4.1.2 268 | - Latest RStudio version 269 | - Pandoc 270 | - Git 271 | 272 | 273 | --- 274 | 275 | Add system-level requirements 276 | 277 | ~~~Dockerfile 278 | # System libraries 279 | RUN apt-get update \ 280 | && apt-get install -y --no-install-recommends \ 281 | * libgsl0-dev \ 282 | * libnlopt-dev \ 283 | * libxt6 \ 284 | * ssh 285 | ~~~ 286 | 287 | 288 | --- 289 | 290 | Install TeX Live 2021 and required LaTeX packages 291 | 292 | ~~~Dockerfile 293 | # TeX Live 294 | ENV CTAN_REPO=http://mirror.ctan.org/systems/texlive/tlnet 295 | RUN /rocker_scripts/install_texlive.sh 296 | ENV PATH=$PATH:/usr/local/texlive/bin/x86_64-linux 297 | 298 | RUN tlmgr install \ 299 | * apa6 apa7 booktabs caption csquotes \ 300 | * ... 301 | ~~~ 302 | 303 | 304 | --- 305 | 306 | Install `papaja` and required R packages 307 | 308 | ~~~Dockerfile 309 | # Setup R packages for papaja 310 | RUN install2.r --error \ 311 | --skipinstalled \ 312 | * tinytex \ 313 | * remotes \ 314 | * markdown \ 315 | * mime 316 | 317 | ## Latest papaja development version 318 | RUN Rscript -e "remotes::install_github('crsh/papaja')" 319 | ~~~ 320 | 321 | --- 322 | 323 | Our image bundles (among other things) 324 | 325 | - Latest Debian version 326 | - R 4.1.2 327 | - Latest RStudio version 328 | - Pandoc 329 | - Git 330 | 331 | -- 332 | - .highlight[TeX Live 2021] 333 | - .highlight[Latest `papaja` version] 334 | 335 | 336 | --- 337 | exclude: true 338 | 339 | Online services (e.g. CodeOcean, Clyburne-Sherin, Fei, & Green, 2019) 340 | 341 | ```{r out.width = "600px"} 342 | include_graphics("img/codeocean.png") 343 | ``` 344 | 345 | Limited computational resources 346 | 347 | 348 | --- 349 | 350 | [A minimally obtrusive Docker workflow to work reproducibly with papaja](https://github.com/crsh/papaja_docker) 351 | 352 | ```{r out.width = "700px"} 353 | include_graphics("img/papaja-docker-repo.png") 354 | ``` 355 | 356 | 357 | --- 358 | layout: false 359 | class: middle, center 360 | 361 | # A quick demonstration! 362 | 363 | 364 | --- 365 | 366 | 367 | 368 | # Publishing reproducible research environments 369 | 370 | If you want to publicly share your fully reproducible research environment and allow others to interact with it without having to install any software on their own machines, you can use services like [*Code Ocean*](https://codeocean.com/) or [*RStudio Cloud*](https://rstudio.cloud/). A good free and open source alternative is [*BinderHub*](https://binderhub.readthedocs.io/en/latest/). 371 | 372 | --- 373 | 374 | # What is *BinderHub*? 375 | 376 | From the [*BinderHub GitHub* repository](https://github.com/jupyterhub/binderhub): 377 | 378 | *BinderHub* allows you to `BUILD` and `REGISTER` a `Docker` image from a `Git` repository, then `CONNECT` with *JupyterHub*, allowing you to create a public IP address that allows users to interact with the code and environment within a live *JupyterHub* instance. You can select a specific branch name, commit, or tag to serve. 379 | 380 | --- 381 | 382 | # What is *BinderHub*? 383 | 384 | From the [*BinderHub GitHub* repository](https://github.com/jupyterhub/binderhub): 385 | 386 | *BinderHub* ties together: 387 | 388 | - [*JupyterHub*](https://github.com/jupyterhub/jupyterhub) to provide a scalable system for authenticating users and spawning single user [`Jupyter Notebook`](https://jupyter.org/) servers, and 389 | - [*Repo2Docker*](https://github.com/jupyter/repo2docker) which generates a `Docker` image using a `Git` repository hosted online. 390 | 391 | --- 392 | 393 | # What is *BinderHub*? 394 | 395 | ```{r binger-img, out.width = "125%", echo=FALSE} 396 | include_graphics("./img/binderhub.png") 397 | ``` 398 | 399 | --- 400 | 401 | # How to use *BinderHub* 402 | 403 | Using a *BinderHub* deployment like [*mybinder.org*](https://mybinder.org/) or [*GESIS Notebooks*](https://notebooks.gesis.org/binder/) you can turn an existing public `Git` repository into a publicly accessible executable environment. 404 | 405 | In order for this to work, you just need to add a few *Binder*-specific files to your repo (i.e., "Binderize" it). 406 | 407 | -- 408 | 409 | .small[ 410 | A platform that works in similar ways is [*PsychNotebook*](https://www.psychnotebook.org/) 411 | by the [Leibniz Institute for Psychology (ZPID)](https://leibniz-psychology.org/en/). 412 | ] 413 | 414 | --- 415 | 416 | # Binderizing your `Git` repository 417 | 418 | The minimum requirements are the following: 419 | 420 | 1. Add a `binder` folder to your repo 421 | 2. In that folder, create two files: `runtime.txt` & `install.R` 422 | 423 | .small[ 424 | *Note*: It would also be ok to add those files to the root folder of your project. 425 | ] 426 | 427 | --- 428 | 429 | # Binderizing your `Git` repository 430 | 431 | In the `runtime.txt` file, you need to specify a version number and date, indicating which [snapshot](https://packagemanager.rstudio.com/client/#/repos/1/overview) to use from the [*R Studio Package Manager*](https://packagemanager.rstudio.com/client/#/). Example: `r-4.1-2022-04-22`). 432 | 433 | --- 434 | 435 | # Binderizing your `Git` repository 436 | 437 | In the `install.R` file, you need to specify which `R` packages to install as you normally would in an `.R` file (e.g., `install.packages(c("gapminder", "tinytex"))`). *CRAN* packages are installed through the [*R Studio Package Manager*](https://packagemanager.rstudio.com/client/#/). 438 | 439 | --- 440 | 441 | # Binderizing your `Git` repository 442 | 443 | There are many more options for changing or extending the executable environment. Two good resources to learn more are the [*Turing Way* guide *Zero-to-Binder*](https://the-turing-way.netlify.app/communication/binder/zero-to-binder.html) or the [*Binder* example for `R`](https://github.com/binder-examples/r). 444 | 445 | --- 446 | 447 | # Deploying your executable environment 448 | 449 | Once you have "Binderized" your repository, you can use [*mybinder.org*](https://mybinder.org/) to create the executable environment. You can set a few additional parameters in the process (such as the branch). *NB*: Creating the executable environment can take some time (esp. if you install many and/or large `R` packages). 450 | 451 | -- 452 | 453 | .small[ 454 | *Note*: You can also use the [`holepunch` package](https://karthik.github.io/holepunch/) to Binderize your `R` project hosted on *GitHub*. 455 | ] 456 | 457 | --- 458 | 459 | # Deploying your executable environment 460 | 461 | Once the executable environment has been created, anyone who has the link to it can use it. The easiest way to share it and enable "1-click reproducibility" for others is by adding a *Launch Binder* button to the `README` for your associated *GitHub* (or *GitLab*) repository. The `Markdown` code for this will be displayed on the *mybinder* site. 462 | 463 | --- 464 | 465 | # Things to note when using *Binder* 466 | 467 | .smaller[ 468 | 1. The *BinderHub* deployments are hosted on free-to-use servers (sometimes by academic institutions), so you might experience some "hiccups" in deploying and using the executable environments (e.g., if the service is heavily used at the time). 469 | 2. Related to that, the amount of RAM is limited for the executable environment. 470 | 3. One thing you need to consider is how to share your data when using *Binder*. The [*Turing Way* guide *Zero-to-Binder*](https://the-turing-way.netlify.app/communication/binder/zero-to-binder.html) has some suggestions for that. 471 | 4. By default, the link to the executable environment will open an instance of [*Jupyter Notebook*](https://jupyter.org/), but it is also possible to run [*Jupyter Lab*](https://jupyterlab.readthedocs.io/en/stable/#), or *RStudio* (this can be done by adding parameters at the end of the URL, such as `$urlpath=rstudio`). 472 | ] 473 | 474 | --- 475 | 476 | # Test drive `r ji("racing_car")` 477 | 478 | We have prepared a Binderized repo for you that you can test, clone, fork or whatever else you would like to to: https://github.com/jobreu/binder-r-demo 479 | 480 | --- 481 | 482 | # Exercise 483 | 484 | Try out and explore one or more of the tools we have just presented: 485 | 486 | - `trackdown` 487 | - one of the `R` packages for dependency management (such as `renv`, `checkpoint`, or `groundhog`) 488 | - `Docker` 489 | - `Binder` 490 | 491 | --- 492 | 493 | # Exercise 494 | 495 | What did you do? 496 | 497 | What were your experiences? 498 | 499 | Do you think you are going to use the tool(s)? Why/why not? If yes, for what purposes? 500 | 501 | --- 502 | 503 | # Project setup and templates 504 | 505 | In this workshop, we have shown you how to manually set up a reproducible research workflows. However, there are some tools that you can use to automate parts of this process. These can range from very simple to very elaborate solutions. We will show you two examples in the following. 506 | 507 | --- 508 | 509 | # Project setup and templates 510 | 511 | `create-project.sh`: small shell script for initializing a basic project folder structure (which can be easily adapted and extended using any text editor) 512 | 513 | To run the file, open a shell/command line interface (and navigate to) where the `create-project.sh` file is located. To execute it, you need to provide a valid path for the new project folder that should be created as an argument. 514 | 515 | --- 516 | 517 | # Project setup and templates 518 | 519 | ```{r eval=FALSE, echo=TRUE} 520 | sh create-project.sh "./my-project" 521 | ``` 522 | 523 | --- 524 | 525 | 526 | 527 | # Project setup and templates 528 | 529 | Frederik's `R` package for initializing new projects: https://github.com/crsh/template 530 | 531 | --- 532 | 533 | 534 | 535 | # Workflow tools 536 | 537 | There also several `R` other packages for facilitating the creation and maintenance of reproducible research workflows, such as... 538 | 539 | - [`WORCS`](https://cjvanlissa.github.io/worcs/index.html) - *Workflow for Open Reproducible Code in Science* 540 | - [`workflowr`](https://workflowr.github.io/workflowr/) 541 | - [`starter`](https://www.danieldsjoberg.com/starter/) 542 | - [`rrtools`](https://github.com/benmarwick/rrtools) - Tools for Writing Reproducible Research in R 543 | 544 | [*start your lab*](https://www.startyourlab.com/) also provides an [`R` Project Template](https://github.com/startyourlab/r-project-template). 545 | 546 | --- 547 | 548 | # Choosing the right tools `r ji("hammer")``r ji("wrench")` 549 | 550 | There are a few things to consider for choosing the right tools: 551 | 552 | - Your **habits, knowledge, and preferences** (as well as those of your collaborators) 553 | - Your **goals** and their relative importance: E.g., computational reproducibility, reusability, replicability 554 | - Your **audience**: Future you, collaborators, the academic community, the general public 555 | 556 | --- 557 | 558 | # Shoulders of giants... but sometimes also clay feet 559 | 560 | .small[ 561 | As you may have already experienced, not all tools always play together nicely. Keep in mind, that most tools that we have covered in this workshop are free and open source software (FOSS). Also, tool stacks can have break points and many tools themselves depend on other tools/tool stacks. Hence, things may not always work perfectly. 562 | 563 | But don't despair! There usually are solutions ([*Stack Overflow*](https://stackoverflow.com/) and issues in associated *GitHub* repositories are good places to find them) and the advantage of FOSS is that there usually is an active development community that you can also get involved in. 564 | ] 565 | 566 | --- 567 | 568 | # Showing appreciation `r ji("clapping_hands")` 569 | 570 | The creation and maintenance of FOSS takes a lot of time and this is rarely recognized as much as it should be. One thing we can do to change this is to at least give credit where credit is due and cite the tools and resources that we use. 571 | 572 | --- 573 | 574 | # Showing appreciation `r ji("clapping_hands")` 575 | 576 | ```{r cite, echo=TRUE} 577 | citation("papaja") 578 | ``` 579 | 580 | --- 581 | 582 | # Showing appreciation `r ji("clapping_hands")` 583 | 584 | When working with `R Markdown`, you can create a `packages.bib` file to cite the packages you have used, either manually, using `papaja::r_refs()`, or the [`grateful` package](https://pakillo.github.io/grateful/). 585 | 586 | --- 587 | 588 | # Share the `r ji("heart")` for reproducible research tools 589 | 590 | In addition to properly citing the tools and resources you use, you can make sure that they get the recognition they deserve by talking about them (e.g., on social media) and convincing your collaborators to use them as well. 591 | 592 | --- 593 | 594 | # Looking back 595 | 596 | You created a *GitHub*/*GitLab* repository containing materials for a fully reproducible research pipeline! `r ji("popper")` 597 | 598 | If you created a public *GitHub* repository: Head over to http://starlogs.net/ and paste the URL of the repository to recap your heroic journey into the universe of reproducible research! `r ji("milky_way")` 599 | 600 | --- 601 | 602 | # Looking forward 603 | 604 | We hope that we could get you started or help you with with making your research (more) reproducible. 605 | Of course, as always, there is much more to explore and learn. The only way to really get familiar with the tools and workflows is if you use them for your own research. 606 | 607 | -- 608 | 609 | Keep calm and stay reproducible! `r ji("smiling_face_with_smiling_eyes")` 610 | 611 | --- 612 | 613 | class: center, middle 614 | 615 | # Thank you very much for participating in this workshop! `r ji("bowing_man")` 616 | 617 | We hope that you learned something and also had some fun (at least a little bit...) 618 | -------------------------------------------------------------------------------- /src/slides/_output.yaml: -------------------------------------------------------------------------------- 1 | xaringan::moon_reader: 2 | lib_dir: libs 3 | chakra: libs/remark-latest.min.js 4 | css: ["src/xaringan-themer.css", "src/slides.css"] 5 | nature: 6 | countIncrementalSlides: false 7 | highlightLines: true 8 | slideNumberFormat: | 9 |
10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /src/slides/_setup.Rmd: -------------------------------------------------------------------------------- 1 | ```{r setup, include=FALSE} 2 | library("knitr") 3 | options(htmltools.dir.version = FALSE, 4 | htmltools.preserve.raw = FALSE) 5 | opts_chunk$set(echo = FALSE, fig.align = "center") 6 | 7 | # remotes::install_github("gadenbuie/xaringanExtra") 8 | # remotes::install_github("hadley/emo") 9 | # remotes::install_github("gadenbuie/tweetrmd") 10 | library(xaringanExtra) 11 | library(xaringanthemer) 12 | library(emo) 13 | library(tweetrmd) 14 | 15 | my_colors <- c("#bc0031", "#d67f42") 16 | ``` 17 | 18 | ```{r extras-styling, include = FALSE} 19 | use_xaringan_extra(c("tile_view", "clipboard")) 20 | 21 | style_mono_accent( 22 | base_color = my_colors[1] 23 | , header_font_google = google_font("Poppins") 24 | , header_h1_font_size = "36pt" 25 | , text_font_google = google_font("Open Sans") 26 | , text_font_size = "22pt" 27 | , text_color = "#3a3a3a" 28 | , code_font_size = "1.1rem" 29 | , outfile = "src/xaringan-themer.css" 30 | ) 31 | ``` 32 | 33 | ```{r} 34 | add_overlay <- function(..., label = NULL, label_style = NULL) { 35 | el <- list(...) 36 | 37 | y <- '
0) { 39 | y <- c(y, 'style="', glue::glue('{names(el)}:{el};')) 40 | } 41 | y <- c(y, '">') 42 | 43 | if(!is.null(label)) { 44 | y <- c(y, glue::glue('{label}')) 45 | } 46 | 47 | knitr::asis_output(glue::glue_collapse(c(y, "
"))) 48 | } 49 | ``` 50 | -------------------------------------------------------------------------------- /src/slides/cosmetic_surgery.Rdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/cosmetic_surgery.Rdata -------------------------------------------------------------------------------- /src/slides/img/Rlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/Rlogo.png -------------------------------------------------------------------------------- /src/slides/img/binderhub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/binderhub.png -------------------------------------------------------------------------------- /src/slides/img/checkpoint-pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/checkpoint-pkg.png -------------------------------------------------------------------------------- /src/slides/img/choose_git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/choose_git.png -------------------------------------------------------------------------------- /src/slides/img/chunk_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/chunk_buttons.png -------------------------------------------------------------------------------- /src/slides/img/code_chunk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/code_chunk.png -------------------------------------------------------------------------------- /src/slides/img/code_chunk_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/code_chunk_options.png -------------------------------------------------------------------------------- /src/slides/img/codeocean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/codeocean.png -------------------------------------------------------------------------------- /src/slides/img/compilation_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/compilation_process.png -------------------------------------------------------------------------------- /src/slides/img/container-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/container-stack.png -------------------------------------------------------------------------------- /src/slides/img/create_rmarkdown_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/create_rmarkdown_menu.png -------------------------------------------------------------------------------- /src/slides/img/dependendy-graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/dependendy-graph.png -------------------------------------------------------------------------------- /src/slides/img/docker-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/docker-logo.png -------------------------------------------------------------------------------- /src/slides/img/git-branching.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git-branching.jpg -------------------------------------------------------------------------------- /src/slides/img/git-fire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git-fire.png -------------------------------------------------------------------------------- /src/slides/img/git-history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git-history.png -------------------------------------------------------------------------------- /src/slides/img/git-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git-status.png -------------------------------------------------------------------------------- /src/slides/img/git-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git-system.png -------------------------------------------------------------------------------- /src/slides/img/git_clone_https.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_clone_https.png -------------------------------------------------------------------------------- /src/slides/img/git_clone_ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_clone_ssh.png -------------------------------------------------------------------------------- /src/slides/img/git_commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_commit.png -------------------------------------------------------------------------------- /src/slides/img/git_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_menu.png -------------------------------------------------------------------------------- /src/slides/img/git_menu_rstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_menu_rstudio.png -------------------------------------------------------------------------------- /src/slides/img/git_pane_files_changed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_pane_files_changed.png -------------------------------------------------------------------------------- /src/slides/img/git_staged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/git_staged.png -------------------------------------------------------------------------------- /src/slides/img/github-add-collaborator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-add-collaborator.png -------------------------------------------------------------------------------- /src/slides/img/github-clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-clone.png -------------------------------------------------------------------------------- /src/slides/img/github-commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-commit.png -------------------------------------------------------------------------------- /src/slides/img/github-edit-pr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-edit-pr.png -------------------------------------------------------------------------------- /src/slides/img/github-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-edit.png -------------------------------------------------------------------------------- /src/slides/img/github-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-home.png -------------------------------------------------------------------------------- /src/slides/img/github-inline-comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-inline-comment.png -------------------------------------------------------------------------------- /src/slides/img/github-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-logo.png -------------------------------------------------------------------------------- /src/slides/img/github-merge-conflict-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-merge-conflict-edit.png -------------------------------------------------------------------------------- /src/slides/img/github-merge-conflict-resolve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-merge-conflict-resolve.png -------------------------------------------------------------------------------- /src/slides/img/github-merge-conflict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-merge-conflict.png -------------------------------------------------------------------------------- /src/slides/img/github-new-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-new-repo.png -------------------------------------------------------------------------------- /src/slides/img/github-open-pr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-open-pr.png -------------------------------------------------------------------------------- /src/slides/img/github-pr-branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-pr-branch.png -------------------------------------------------------------------------------- /src/slides/img/github-pr-branch2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-pr-branch2.png -------------------------------------------------------------------------------- /src/slides/img/github-pr-review.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-pr-review.png -------------------------------------------------------------------------------- /src/slides/img/github-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/github-workflow.png -------------------------------------------------------------------------------- /src/slides/img/gitignore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gitignore.png -------------------------------------------------------------------------------- /src/slides/img/gitlab-add-collaborator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gitlab-add-collaborator.png -------------------------------------------------------------------------------- /src/slides/img/gitlab-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gitlab-home.png -------------------------------------------------------------------------------- /src/slides/img/gitlab-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gitlab-logo.png -------------------------------------------------------------------------------- /src/slides/img/gitlab-new-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gitlab-new-repo.png -------------------------------------------------------------------------------- /src/slides/img/gl_ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/gl_ssh.png -------------------------------------------------------------------------------- /src/slides/img/hands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/hands.png -------------------------------------------------------------------------------- /src/slides/img/hermann-docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/hermann-docker.png -------------------------------------------------------------------------------- /src/slides/img/hermann.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/hermann.png -------------------------------------------------------------------------------- /src/slides/img/inline_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/inline_code.png -------------------------------------------------------------------------------- /src/slides/img/papaja-docker-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/papaja-docker-repo.png -------------------------------------------------------------------------------- /src/slides/img/papaja_hex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/papaja_hex.png -------------------------------------------------------------------------------- /src/slides/img/papaja_skeleton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/papaja_skeleton.png -------------------------------------------------------------------------------- /src/slides/img/replication-typology-a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/replication-typology-a.jpg -------------------------------------------------------------------------------- /src/slides/img/reproducibility-schema-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/reproducibility-schema-1.png -------------------------------------------------------------------------------- /src/slides/img/reproducibility_court.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/reproducibility_court.png -------------------------------------------------------------------------------- /src/slides/img/reproducible-matrix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/reproducible-matrix.jpg -------------------------------------------------------------------------------- /src/slides/img/result_formatting_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/result_formatting_process.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_example.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_example_annotated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_example_annotated.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_formats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_formats.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_preview.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_process.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_rockstar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_rockstar.png -------------------------------------------------------------------------------- /src/slides/img/rmarkdown_wizards.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rmarkdown_wizards.png -------------------------------------------------------------------------------- /src/slides/img/rocker-images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rocker-images.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-branches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-branches.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-git-commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-git-commit.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-git-history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-git-history.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-git-pushed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-git-pushed.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-git-untracked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-git-untracked.png -------------------------------------------------------------------------------- /src/slides/img/rstudio-new-git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio-new-git.png -------------------------------------------------------------------------------- /src/slides/img/rstudio_open_visual_rmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio_open_visual_rmd.png -------------------------------------------------------------------------------- /src/slides/img/rstudio_visual_rmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/rstudio_visual_rmd.png -------------------------------------------------------------------------------- /src/slides/img/setup_chunk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/setup_chunk.png -------------------------------------------------------------------------------- /src/slides/img/srt-thin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/srt-thin.gif -------------------------------------------------------------------------------- /src/slides/img/ssh_key_gitlab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/ssh_key_gitlab.png -------------------------------------------------------------------------------- /src/slides/img/standard-finding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/standard-finding.png -------------------------------------------------------------------------------- /src/slides/img/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/terminal.png -------------------------------------------------------------------------------- /src/slides/img/terminal_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/terminal_menu.png -------------------------------------------------------------------------------- /src/slides/img/toppling-tower.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/toppling-tower.jpg -------------------------------------------------------------------------------- /src/slides/img/trr-cube.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/trr-cube.jpg -------------------------------------------------------------------------------- /src/slides/img/turing_way_parts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/turing_way_parts.jpg -------------------------------------------------------------------------------- /src/slides/img/vc_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/vc_project.png -------------------------------------------------------------------------------- /src/slides/img/vm-stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crsh/reproducible-research-practices-workshop/00f7e327622e14939790475a345b14848cfc95b8/src/slides/img/vm-stack.png -------------------------------------------------------------------------------- /src/slides/libs/clipboard/clipboard.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * clipboard.js v2.0.6 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 o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /src/slides/libs/tile-view/tile-view.css: -------------------------------------------------------------------------------- 1 | .remark__tile-view * { 2 | box-sizing: border-box; 3 | } 4 | 5 | .remark__tile-view { 6 | background: lightgray; 7 | position: relative; 8 | width: 100%; 9 | height: 100%; 10 | padding: 3em; 11 | font-size: 18px; 12 | box-sizing: border-box; 13 | overflow: scroll; 14 | } 15 | 16 | .remark__tile-view__header { 17 | text-align: center; 18 | } 19 | 20 | .remark__tile-view__tiles { 21 | display: grid; 22 | /* Set column width in JS */ 23 | /* grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); */ 24 | justify-items: center; 25 | } 26 | 27 | .remark__tile-view__tile { 28 | position: relative; 29 | margin: 0.5em; 30 | padding: 0.5em; 31 | } 32 | 33 | .remark__tile-view__slide-container { 34 | margin: 0 auto; 35 | } 36 | 37 | .remark__tile-view__tile--current { 38 | background: #ffd863; 39 | border: 5px solid #ffd863; 40 | margin: calc(0.5em - 5px); 41 | border-radius: 0; 42 | } 43 | 44 | .remark__tile-view__tile--seen { 45 | opacity: 0.5; 46 | } 47 | 48 | .remark__tile-view__tile:hover { 49 | /* background: #993d70; */ 50 | background: #44bc96; 51 | opacity: 1; 52 | } 53 | -------------------------------------------------------------------------------- /src/slides/libs/tile-view/tile-view.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Tile View for remark.js Slides 3 | * 4 | * Garrick Aden-Buie 5 | * 6 | * Inspired and converted to Vanilla JS from 7 | * https://github.com/StephenHesperus/remark-hook/ 8 | * 9 | * Include after remarkjs slides are initialized. 10 | * 11 | */ 12 | 13 | /* global slideshow */ 14 | (function () { 15 | const ready = function (fn) { 16 | /* MIT License Copyright (c) 2016 Nuclei */ 17 | /* https://github.com/nuclei/readyjs */ 18 | const completed = () => { 19 | document.removeEventListener('DOMContentLoaded', completed) 20 | window.removeEventListener('load', completed) 21 | fn() 22 | } 23 | if (document.readyState !== 'loading') { 24 | setTimeout(fn) 25 | } else { 26 | document.addEventListener('DOMContentLoaded', completed) 27 | window.addEventListener('load', completed) 28 | } 29 | } 30 | 31 | ready(function () { 32 | const launchKey = 79 // keycode for O, used to enable tile view 33 | 34 | // Slides container 35 | const remarkSlideShow = document.querySelector('div.remark-slides-area') 36 | 37 | let tileView = document.querySelector('div.remark__tile-view') 38 | if (!tileView) { 39 | tileView = document.createElement('div') 40 | tileView.className = 'remark__tile-view' 41 | } 42 | 43 | const toggleElement = el => { 44 | el.style.display = el.style.display === 'none' ? '' : 'none' 45 | } 46 | 47 | function slideshowResize () { 48 | window.dispatchEvent(new Event('resize')) 49 | } 50 | 51 | const toggleTileView = function () { 52 | toggleElement(tileView) 53 | toggleElement(remarkSlideShow) 54 | 55 | if (tileView.style.display === 'none') { 56 | // tileView is now hidden, go to current slide 57 | slideshow.gotoSlide(tileVars.currentSlideIdx + 1) 58 | 59 | slideshow.resume() 60 | slideshowResize() 61 | } else { 62 | // store current slide index prior to launching tile-view 63 | tileVars.currentSlideIdx = slideshow.getCurrentSlideIndex() 64 | 65 | // set class on seen and current slide and scroll into view 66 | const tiles = tileView.querySelectorAll('.remark__tile-view__tile'); 67 | [...tiles].forEach((tile, idx) => { 68 | tile.classList.toggle( 69 | 'remark__tile-view__tile--seen', 70 | idx < tileVars.currentSlideIdx 71 | ) 72 | tile.classList.toggle( 73 | 'remark__tile-view__tile--current', 74 | idx === tileVars.currentSlideIdx 75 | ) 76 | }) 77 | tiles[tileVars.currentSlideIdx].scrollIntoView({ 78 | behavior: 'smooth', 79 | block: 'center' 80 | }) 81 | 82 | slideshow.pause() 83 | } 84 | } 85 | 86 | const createTileView = ({ minSize = 250, title = document.title } = {}) => { 87 | // Tile view header 88 | const h1 = document.createElement('h1') 89 | h1.className = 'remark__tile-view__header' 90 | h1.innerHTML = title 91 | 92 | tileView.appendChild(h1) 93 | const tiles = document.createElement('div') 94 | tiles.className = 'remark__tile-view__tiles' 95 | tileView.appendChild(tiles) 96 | 97 | // Clone slideshow 98 | const slidesArea = remarkSlideShow.cloneNode(true) 99 | 100 | // Calculate slide scale and tile container size 101 | const slideScaler = slidesArea.querySelector('.remark-slide-scaler') 102 | const slideWidth = parseFloat(slideScaler.style.width.replace('px', '')) 103 | const slideHeight = parseFloat( 104 | slideScaler.style.height.replace('px', '') 105 | ) 106 | const scale = minSize / Math.min(slideWidth, slideHeight) 107 | let tileWidth = Math.round(slideWidth * scale) 108 | let tileHeight = Math.round(slideHeight * scale) 109 | 110 | // convert tileWidth/Height to em relative to base 18px (set in CSS) 111 | tileWidth = tileWidth / 18 112 | tileHeight = tileHeight / 18 113 | 114 | tiles.style.gridTemplateColumns = `repeat(auto-fill, minmax(${tileWidth}em, 1fr))` 115 | 116 | const slides = slidesArea.querySelectorAll('.remark-slide-container') 117 | 118 | slides.forEach((slide, slideIndex) => { 119 | let tile = document.createElement('template') 120 | tile.innerHTML = `
121 |
122 |
` 123 | tile = tile.content.firstChild 124 | 125 | const tileContainer = tile.querySelector( 126 | '.remark__tile-view__slide-container' 127 | ) 128 | tileContainer.style.width = `${tileWidth}em` 129 | tileContainer.style.height = `${tileHeight}em` 130 | 131 | const thisSlideScaler = slide.querySelector('.remark-slide-scaler') 132 | thisSlideScaler.style.top = '0px' 133 | thisSlideScaler.style.left = '0px' 134 | thisSlideScaler.style.transform = `scale(${scale})` 135 | thisSlideScaler.parentElement.classList.add('remark-visible') 136 | 137 | slide.addEventListener('click', () => { 138 | tileVars.currentSlideIdx = slideIndex 139 | toggleTileView() 140 | }) 141 | 142 | tileContainer.appendChild(slide) 143 | tiles.appendChild(tile) 144 | }) 145 | 146 | document.body.appendChild(tileView) 147 | } 148 | 149 | const tileVars = {} 150 | 151 | document.addEventListener('keydown', ev => { 152 | if (ev.keyCode === launchKey) { 153 | toggleTileView() 154 | } 155 | }) 156 | 157 | const addTileViewHelpText = () => { 158 | const helpTable = document.querySelector( 159 | '.remark-help-content table.light-keys' 160 | ) 161 | if (!helpTable) { 162 | console.error( 163 | 'Could not find remark help table, has remark been initialized?' 164 | ) 165 | return 166 | } 167 | const newRow = document.createElement('tr') 168 | newRow.innerHTML += 'o' 169 | newRow.innerHTML += 'Tile View: Overview of Slides' 170 | helpTable.append(newRow) 171 | } 172 | 173 | createTileView({ minSize: 200 }) 174 | toggleElement(tileView) 175 | addTileViewHelpText() 176 | }) 177 | })() 178 | -------------------------------------------------------------------------------- /src/slides/libs/xaringanExtra-clipboard/xaringanExtra-clipboard.css: -------------------------------------------------------------------------------- 1 | .xaringanextra-clipboard-button { 2 | position: absolute; 3 | top: 0; 4 | right: 0; 5 | font-size: 0.8em; 6 | padding: 0.5em; 7 | display: none; 8 | background-color: transparent; 9 | border: none; 10 | opacity: 0.5; 11 | border-radius: 0; 12 | } 13 | 14 | .xaringanextra-clipboard-button:hover { 15 | background-color: rgba(0, 0, 0, 0.1); 16 | border: none; 17 | opacity: 1; 18 | } 19 | 20 | :hover > .xaringanextra-clipboard-button { 21 | display: block; 22 | transform: translateY(0); 23 | } 24 | -------------------------------------------------------------------------------- /src/slides/libs/xaringanExtra-clipboard/xaringanExtra-clipboard.js: -------------------------------------------------------------------------------- 1 | /* global slideshow,window,document */ 2 | window.xaringanExtraClipboard = function (selector, text) { 3 | if (!window.ClipboardJS.isSupported()) return 4 | if (!window.xaringanExtraClipboards) window.xaringanExtraClipboards = {} 5 | 6 | const ready = function (fn) { 7 | /* MIT License Copyright (c) 2016 Nuclei */ 8 | /* https://github.com/nuclei/readyjs */ 9 | const completed = () => { 10 | document.removeEventListener('DOMContentLoaded', completed) 11 | window.removeEventListener('load', completed) 12 | fn() 13 | } 14 | if (document.readyState !== 'loading') { 15 | setTimeout(fn) 16 | } else { 17 | document.addEventListener('DOMContentLoaded', completed) 18 | window.addEventListener('load', completed) 19 | } 20 | } 21 | 22 | ready(function () { 23 | const { 24 | button: buttonText = 'Copy Code', 25 | success: successText = 'Copied!', 26 | error: errorText = 'Press Ctrl+C to Copy' 27 | } = text 28 | 29 | const template = '` 31 | 32 | const isRemarkSlideshow = typeof slideshow !== 'undefined' && 33 | Object.prototype.hasOwnProperty.call(slideshow, 'getSlides') 34 | 35 | let siblingSelector = selector || 'pre' 36 | if (!selector && isRemarkSlideshow) { 37 | siblingSelector = '.remark-slides-area ' + siblingSelector 38 | } 39 | 40 | // insert