From 180abc81de5aebdfdebec14bdedaf8c50e6b3cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Wed, 1 May 2024 14:29:32 +0200 Subject: [PATCH 01/33] docs: GitLab -> GitHub --- index.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.qmd b/index.qmd index 8c294da..1f2da6a 100644 --- a/index.qmd +++ b/index.qmd @@ -49,9 +49,9 @@ Want to contribute to this course? Check out the [README](https://github.com/rostools/r-cubed-intermediate/blob/main/README.md) file as well as the [CONTRIBUTING](https://github.com/rostools/r-cubed-intermediate/blob/main/CONTRIBUTING.md) -file on the GitLab repository for more details. The main way to +file on the GitHub repository for more details. The main way to contribute is by using [GitHub](https://github.com/) and creating a [new -Issue](https://github.com/rostools/r-cubed-intermediate/issues/new) to +issue](https://github.com/rostools/r-cubed-intermediate/issues/new) to make comments and give feedback for the material. ## Target audiences From e1cac463a6a950a3e0587fbb80b2d19b0dfa1f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Wed, 1 May 2024 14:30:02 +0200 Subject: [PATCH 02/33] docs: minor text mods --- index.qmd | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.qmd b/index.qmd index 1f2da6a..f68e825 100644 --- a/index.qmd +++ b/index.qmd @@ -14,20 +14,20 @@ knitr::write_bib( Reproducibility and open scientific practices are increasingly demanded of, and needed by, scientists and researchers in our modern research -environments. As we our tools for generating data become more -sophisticated and powerful, we also need to start using more -sophisticated and powerful tools for processing it. Training on how to -use these tools and build modern data analysis skills is lacking for -researchers, even though this work is highly time-consuming and -technical. As a consequence of this unawareness of the need for these -skills, how *exactly* data is processed is poorly, if at all, described -in scientific studies. This hidden aspect of research could have major +environments. As our tools for generating data become more sophisticated +and powerful, we also need to start using more sophisticated and +powerful tools for processing it. Training on how to use these tools and +how to build modern data analysis skills is lacking for researchers, +even though this work is highly time-consuming and technical. As a +consequence of an unawareness of the need for these skills, how +*exactly* data is processed is poorly, if at all, described in +scientific studies. This hidden aspect of research could have major impacts on the reproducibility of studies. Therefore, this course was created specifically to start addressing these types of problems. The course is designed as a series of participatory live-coding lessons, -where the instructor and learner code together, and is interspersed with -hands-on exercises and group work using real-world datasets. This +where the instructor and learners code together, and is interspersed +with hands-on exercises and group work using real-world datasets. This website contains all of the material for the course, from reading material to exercises to images. It is structured as a book, with "chapters" as lessons, given in order of appearance. We make heavy use From 399c9e075566b7a09b11de711795213b454b026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Wed, 1 May 2024 14:50:31 +0200 Subject: [PATCH 03/33] docs: slighty rewrite list of what participants of the course will learn to avoid the phrase "[...] will be able to 1. learn [...]" --- preamble/syllabus.qmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/preamble/syllabus.qmd b/preamble/syllabus.qmd index 78f27c3..478fdc2 100644 --- a/preamble/syllabus.qmd +++ b/preamble/syllabus.qmd @@ -19,15 +19,15 @@ irreproducible results. With this course, we aim to begin addressing this gap. Using a highly practical approach that revolves around code-along sessions (instructor and learner coding together), hands-on exercises, and group work, -participants of the course will be able to: +participants of the course will learn: -1. Learn and demonstrate what an open and reproducible data processing - and analysis workflow looks like. -2. Learn and apply some fundamental concepts, techniques, and skills +1. How to demonstrate what an open and reproducible data processing and + analysis workflow looks like. +2. How to apply some fundamental concepts, techniques, and skills needed for processing and managing data in a reproducible and well-documented way. -3. Learn where to go to get help and to continue learning modern data - science and analysis skills. +3. Where to go to get help and to continue learning modern data science + and analysis skills. By the end of the course, participants will: have improved their competency in processing and wrangling datasets; have improved their From c72fdbe442eb754c3e77e230f327db11e71dcd3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Wed, 1 May 2024 14:51:03 +0200 Subject: [PATCH 04/33] docs: Change inline list to ordered list --- preamble/syllabus.qmd | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/preamble/syllabus.qmd b/preamble/syllabus.qmd index 478fdc2..2de7813 100644 --- a/preamble/syllabus.qmd +++ b/preamble/syllabus.qmd @@ -29,12 +29,13 @@ participants of the course will learn: 3. Where to go to get help and to continue learning modern data science and analysis skills. -By the end of the course, participants will: have improved their -competency in processing and wrangling datasets; have improved their -proficiency in using the [R](https://www.r-project.org/) statistical -computing language; know how to write re-usable and well-documented -code; and know how to make modern and reproducible data analysis -projects. +By the end of the course, participants will: + +1. Have improved their competency in processing and wrangling datasets; +2. Have improved their proficiency in using the + [R](https://www.r-project.org/) statistical computing language; +3. Know how to write re-usable and well-documented code; +4. Know how to make modern and reproducible data analysis projects. ## Is this course for you? {#sec-is-it-for-you} From f197bcb685a53aeb8ec9a67226126b597a1198a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Wed, 1 May 2024 14:51:28 +0200 Subject: [PATCH 05/33] docs: add missing "are" and "the" --- preamble/syllabus.qmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/preamble/syllabus.qmd b/preamble/syllabus.qmd index 2de7813..5654c5f 100644 --- a/preamble/syllabus.qmd +++ b/preamble/syllabus.qmd @@ -44,7 +44,7 @@ This course is designed in a specific way and is ideal for you if: - You are a researcher, preferably working in the biomedical field (ranging from experimental to epidemiological). Specifically, this course targets those working on topics in diabetes and metabolism. -- You currently or will soon do quantitative data analysis. +- You currently are or will soon do quantitative data analysis. - You either: - have taken the [introduction to Reproducible Research in R course](https://r-cubed-intro.rostools.org/), since this course @@ -58,10 +58,10 @@ This course is designed in a specific way and is ideal for you if: Considering that this is a natural extension of the [introductory r-cubed course](https://r-cubed-intro.rostools.org/), this course incorporates tools learned during that course, including basic Git usage -as well as use of RStudio R Projects. If you *do not* have familiarity -with these tools, you will need to go over the material from the -introduction course beforehand (more details about pre-course tasks will -be sent out a couple of weeks before the course). +as well as the use of RStudio R Projects. If you *do not* have +familiarity with these tools, you will need to go over the material from +the introduction course beforehand (more details about pre-course tasks +will be sent out a couple of weeks before the course). While having these assumptions help to focus the content of the course, if you have an interest in learning R but don't fit any of the above From 7049fbfc85ebbe50db4b0070fb0e25ed873a760d Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Sat, 4 May 2024 16:49:10 +0200 Subject: [PATCH 06/33] chore: regenerate files after website build --- data/mmash.rda | Bin 3737 -> 3733 bytes includes/packages.bib | 14 +++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/data/mmash.rda b/data/mmash.rda index 94eeb71bc01538d80dcb2ad50b5cbdfe2699862e..380bd2e5450545033737e20069e2525c083c2aea 100644 GIT binary patch delta 3652 zcmV-K4!iN09hDspLRx4!F+o`-Q(3czfzXi-C>9660018XQ)~bL0000000fu-CIA9p zk&zn*0!#oC00A(OksFa{BY!nh2qx6@r-oD2JZTzYVuz>$Pf%!SpbY>34FC^NJwO1^ z41hGy27mz3pfm=9O#^BTG&Z5?27^G+p`ZW;MH*8nr>FpWfHct10004y01W^D0i!?w zXaE2J001-tAOHXW0009(0017KRYZXkAZRo-Fa-55XeNd!hM5yGWPeX7sPbZBn@tRwPeVxf0m8#Uf}jN; zgjGNhN+DPhfHi75W*-m*u)=_&8gYyuG)gf*LZmoagaOec3Y8qvOdzHLh75p&lvSuS zq`G32rywe?3xyq*=zmjTuA1>hvL%S20UKjx8svoxfWMMJkjUDRJpuP3ODX}dKmb63 zK@$Ze07McQsscc4qyhk>f&f4eUll?iAdCFz#-JRGuxxD_r|8g@#~wz^@DX@?^@I{Z zoFD*#FGvU>?$L4o&PW0f`jLVNAw>ibV{*AJccIC}KQg~N_J2Z;1YpWj2wV&)W`yWR zD^cetFvLm{grO)(5`>_I3?n*xpOO)@{lC$F$VHOMu$9|LtO1Q~s(bAg6zZF~CcP;ThL9rD;oreky3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c52 100644 --- a/includes/packages.bib +++ b/includes/packages.bib @@ -100,7 +100,7 @@ @Manual{R-purrr @Manual{R-r3, title = {r3: Companion Package for the R3 Courses}, author = {Luke Johnston}, - year = {2023}, + year = {2024}, note = {R package version 0.2.5}, url = {https://github.com/rostools/r3}, } @@ -113,6 +113,14 @@ @Manual{R-r3admin url = {https://github.com/rostools/r3admin}, } +@Manual{R-readr, + title = {readr: Read Rectangular Text Data}, + author = {Hadley Wickham and Jim Hester and Jennifer Bryan}, + year = {2024}, + note = {R package version 2.1.5}, + url = {https://readr.tidyverse.org}, +} + @Manual{R-snakecase, title = {snakecase: Convert Strings into any Case}, author = {Malte Grosser}, @@ -133,8 +141,8 @@ @Manual{R-stringr @Manual{R-styler, title = {styler: Non-Invasive Pretty Printing of R Code}, author = {Kirill Müller and Lorenz Walthert}, - year = {2023}, - note = {R package version 1.10.2}, + year = {2024}, + note = {R package version 1.10.3}, url = {https://github.com/r-lib/styler}, } From 8768152d421e35f78683528a0ffd36675901787e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 08:52:57 +0200 Subject: [PATCH 07/33] docs: the -> this --- preamble/pre-course.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preamble/pre-course.qmd b/preamble/pre-course.qmd index ba03ee9..97530b9 100644 --- a/preamble/pre-course.qmd +++ b/preamble/pre-course.qmd @@ -159,7 +159,7 @@ Checking Git config settings: survey questions**. *Note* that while GitHub is a natural connection to using Git, given the limited time available, we will not be going over how to use GitHub. If you want to learn about using GitHub, check out -the +this [session](https://r-cubed-intro.rostools.org/sessions/version-control.html) on it in the introduction course. From 05062d69040b8e4725a3735a44d1ca2dfc503be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 08:54:58 +0200 Subject: [PATCH 08/33] docs: add sentence on what the qmd will be used for when learners are creating it --- preamble/pre-course.qmd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/preamble/pre-course.qmd b/preamble/pre-course.qmd index 97530b9..62401c5 100644 --- a/preamble/pre-course.qmd +++ b/preamble/pre-course.qmd @@ -267,6 +267,9 @@ usethis::with_project( ) ``` +Throughout the course, we will use this document as a sandbox to test +code out and then move the finished code to other files. + ## Download the course data {#sec-download-data} To best demonstrate the concepts in the course, we ideally should work From ed20ea9b87cb8b4e0719c094e92a78255eb31a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 08:55:52 +0200 Subject: [PATCH 09/33] docs: add that the PhysioNet website described the MMASH data --- preamble/pre-course.qmd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/preamble/pre-course.qmd b/preamble/pre-course.qmd index 62401c5..6acae20 100644 --- a/preamble/pre-course.qmd +++ b/preamble/pre-course.qmd @@ -296,8 +296,9 @@ website](https://physionet.org/content/mmash/1.0.0/): use personal data, but it *does not prohibit sharing it or making it public*! GDPR and Open Data are not in conflict. -> *Note*: Sometimes the PhysioNet website is slow. If that's the case, -> use [**this alternative link**](resources/mmash-page.html) instead. +> *Note*: Sometimes the PhysioNet website, where the MMASH data is +> described, is slow. If that's the case, use [**this alternative +> link**](resources/mmash-page.html) instead. After looking over the MMASH website, you need to setup where to store the dataset to prepare it for later processing. While in your `LearnR3` From 3721c4e316b66cf166d3915512d78a9b0275a405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 09:00:34 +0200 Subject: [PATCH 10/33] docs: add sentence presenting the list in the learning objectives --- sessions/functionals.qmd | 2 ++ sessions/functions.qmd | 2 ++ sessions/importing.qmd | 2 ++ 3 files changed, 6 insertions(+) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index a2340ca..8fd774b 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -25,6 +25,8 @@ and remind everyone the 'what' and 'why' of what we are doing. ## Learning objectives +The learning objectives of this session are: + 1. Learn about and apply functional programming, vectorization, and functionals within R. 2. Review the split-apply-combine technique and understand the link diff --git a/sessions/functions.qmd b/sessions/functions.qmd index dd75ce3..8457411 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -23,6 +23,8 @@ covering.](/images/overview-workflow.svg){#fig-overview-workflow} ## Learning objectives +The learning objectives of this session are: + 1. Learn what functions are in R and how to create and use them. 2. Learn a workflow of using Quarto, `source()` with {{< var keybind.source >}} and restarting R with diff --git a/sessions/importing.qmd b/sessions/importing.qmd index 9246b13..804c4c2 100644 --- a/sessions/importing.qmd +++ b/sessions/importing.qmd @@ -61,6 +61,8 @@ LearnR3 ## Learning objectives +The learning objectives for this session are: + 1. Learn how to import data and do minor cleaning with the `{readr}` package. 2. Learn about strategies and resources to use when encountering From 149fe2d1079f7f64842d720ac478f4faca3c4612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 09:01:01 +0200 Subject: [PATCH 11/33] docs: rstudio -> posit --- sessions/functionals.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 8fd774b..03ee9ba 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -46,8 +46,8 @@ functionals are better coding patterns to use compared to loops. Doing the code-along should also help reinforce this concept. Also highlight that the resources appendix has some links for continued -learning for this and that the RStudio `{purrr}` cheatsheet is an -amazing resource to use. +learning for this and that the Posit `{purrr}` cheatsheet is an amazing +resource to use. ::: ::: callout-note From 447ee57c07c76f6a42f26181a05047c435c3694a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:04:53 +0200 Subject: [PATCH 12/33] docs: minor text edits and typo fixes --- sessions/functionals.qmd | 106 ++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 03ee9ba..ab32d72 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -78,7 +78,7 @@ entire vector (e.g. `c(1, 2, 3, 4)`) and R will know what to do with it. ![A function using vectorization. Notice how a set of items is included *all at once* in the `func()` function and outputs a single item on the -right. Modified from the [RStudio purrr +right. Modified from the [Posit purrr cheatsheet](https://raw.githubusercontent.com/rstudio/cheatsheets/master/purrr.pdf).](/images/vectorization.png){#fig-vectorization width="45%"} @@ -116,7 +116,7 @@ difficult to easily explain. Because of this and because there are better and easier ways of writing R code to replace for loops, we will **not** be covering loops in this course. -A functional on the other hand is a function that can also use a +A **functional** on the other hand is a function that can also use a function as one of its arguments. @fig-functionals shows how the functional `map()` from the `{purrr}` package works by taking a vector (or list), applying a function to each of those items, and outputting @@ -124,10 +124,10 @@ the results from each function. The name `map()` doesn't mean a geographic map, it is the mathematical meaning of map: To use a function on each item in a set of items. -![A functional that uses a function to apply it to each item in a -vector. Notice how each of the green coloured boxes are placed into the -`func()` function and outputs the same number of blue boxes as there are -green boxes. Modified from the [RStudio purrr +![A functional, map, that applies a function to each item in a vector. +Notice how each of the green coloured boxes are placed into the `func()` +function and outputs the same number of blue boxes as there are green +boxes. Modified from the [Posit purrr cheatsheet](https://raw.githubusercontent.com/rstudio/cheatsheets/master/purrr.pdf).](/images/functionals.png){#fig-functionals width="90%"} @@ -240,20 +240,20 @@ Since `{purrr}` is part of the `{tidyverse}`, we don't need to load it with `library()`. The next step for using the `map()` functional is to get a vector or list of all the dataset files available to us. We will return to using the `{fs}` package, which has a function called -`dir_ls()` that finds files of a certain pattern. In our case, the -pattern is `user_info.csv`. So, let's add `library(fs)` to the `setup` -code chunk. Then, go to the bottom of the `doc/learning.qmd` document, -create a new header called `## Using map`, and create a code chunk below -that with {{< var keybind.chunk >}} +`dir_ls()` that finds files of a certain pattern. So, let's add +`library(fs)` to the `setup` code chunk. Then, go to the bottom of the +`doc/learning.qmd` document, create a new header called `## Using map`, +and create a code chunk below that with {{< var keybind.chunk >}} The `dir_ls()` function takes the path that we want to search (`data-raw/mmash/`), uses the argument `regexp` (short for [regular expression](https://r4ds.had.co.nz/strings.html#matching-patterns-with-regular-expressions) or also `regex`) to find the pattern, and `recurse` to look in all -subfolders. We'll cover regular expressions more in the next session. +subfolders. We'll cover regular expressions more in the next session. In +our case, the pattern is `user_info.csv`, so the code should look like +this: -```{r list-user-info-files} -#| filename: "doc/learning.qmd" +``` {.r filename="doc/learning.qmd"} user_info_files <- dir_ls(here("data-raw/mmash/"), regexp = "user_info.csv", recurse = TRUE @@ -269,15 +269,14 @@ user_info_files ``` ```{r admin-list-files-for-book} -#| echo: false head(gsub(".*\\/data-raw", "data-raw", user_info_files), 3) +print("...") ``` Alright, we now have all the files ready to give to `map()`. So let's try it! -```{r} -#| filename: "doc/learning.qmd" +``` {.r filename="doc/learning.qmd"} user_info_list <- map(user_info_files, import_user_info) ``` @@ -285,15 +284,14 @@ Remember, that `map()` always outputs a list, so when we look into this object, it will give us 22 tibbles (data.frames). Here we'll only show the first one: -```{r} -#| filename: "doc/learning.qmd" +``` {.r filename="doc/learning.qmd"} user_info_list[[1]] ``` This is great because with one line of code we imported all these datasets! But we're missing an important bit of information: The user -ID. A powerful feature of the `{purrr}` package is that it has other -functions to make working with functionals easier. We know `map()` +ID. A powerful feature of the `{purrr}` package is that it gas other +functions to make it easier to work with functionals. We know `map()` always outputs a list. But what we want is a single data frame at the end that also contains the user ID information. @@ -306,8 +304,7 @@ the user ID, or in this case, the file path to the dataset, which has the user ID information in it. So, let's use it and create a new column called `file_path_id`. -```{r} -#| filename: "doc/learning.qmd" +``` {.r filename="doc/learning.qmd"} user_info_df <- map(user_info_files, import_user_info) |> list_rbind(names_to = "file_path_id") ``` @@ -329,9 +326,9 @@ user_info_df |> We're using the base R `|>` pipe rather than the `{magrittr}` pipe `%>%` as more documentation and packages are using or relying on it. In terms of functionality, they are nearly the same, with some small differences. -It ultimately doesn't matter which one you use, but we're using to be -consistent with other documentation and with the general trend to -recommend it over the `{magrittr}` pipe. +It ultimately doesn't matter which one you use, but we're using the base +R `|>` pipe to be consistent with other documentation and with the +general trend to recommend it over the `{magrittr}` pipe. ::: Now that we have this working, let's **add and commit** the changes to @@ -371,12 +368,14 @@ works to import the other three datasets. - Within `function()`, set two new arguments called `file_pattern` and `import_function`. - Within the code, replace and re-write `"user_info.csv"` with - `file_pattern` (this is *without* quotes around it) and - `import_user_info` with `import_function` (also *without* + `file_pattern` (this is *without* quotes around it, otherwise R + will read it as the pattern it should look for is a string with + the value "file_pattern" and not the argument `file_pattern`) + and `import_user_info` with `import_function` (also *without* quotes). - Create generic intermediate objects (instead of `user_info_files` and `user_info_df`). So, replace and re-write - `user_info_file` with `data_files` and `user_info_df` with + `user_info_files` with `data_files` and `user_info_df` with `combined_data`. - Use `return(combined_data)` at the end of the function to output the imported data frame. @@ -439,9 +438,9 @@ import_multiple_files("saliva.csv", import_saliva) ## Adding to the processing script and clean up Quarto document -We've now made a function that imports multiple data files based on the -type of data file, we can start using this function directly, like we -did in the exercise above for the saliva data. We've already imported +Now that we've made a function that imports multiple data files based on +the type of data file, we can start using this function directly, like +we did in the exercise above for the saliva data. We've already imported the `user_info_df` previously, but now we should do some tidying up of our Quarto file and to start updating the `data-raw/mmash.R` script. Why are we doing that? Because the Quarto file is only a sandbox to test @@ -455,8 +454,7 @@ code chunk below the `setup` chunk where we will use the `import_multiple_files()` function to import the user info and saliva data. -```{r} -#| filename: "doc/learning.qmd" +``` {.r filename="doc/learning.qmd"} user_info_df <- import_multiple_files("user_info.csv", import_user_info) saliva_df <- import_multiple_files("saliva.csv", import_saliva) ``` @@ -465,11 +463,14 @@ To test that things work, we'll create an HTML document from our Quarto document by using the "Render" / "Knit" button at the top of the pane or with {{< var keybind.render >}}. Once it creates the file, it should either pop up or open in the Viewer pane on the side. If it works, then -we can move on and open up the `data-raw/mmash.R` script. Inside the -script, copy and paste these two lines of code to the bottom of the -script. Afterwards, go the top of the script and right below the -`library(here)` code, add these two lines of code, so it looks like -this: +we can move on and open up the `data-raw/mmash.R` script. Otherwise, +this is a sign that there is an error in your code and that might not be +reproducible. + +Inside the `data-raw/mmash.R` script, copy and paste these two lines of +code to the bottom of the script. Afterwards, go the top of the script +and right below the `library(here)` line at the top of the script, add +these two lines of code, so it looks like this: ``` {.r filename="data-raw/mmash.R"} library(here) @@ -492,7 +493,7 @@ them know they can read more about this in this section. We're taking a quick detour to briefly talk about a concept that perfectly illustrates how vectorization and functionals fit into doing data analysis. The concept is called the -[split-apply-combine](https://r-cubed-intro.rostools.org/session/wrangling.html#split-apply-combine-summarizing-data) +[split-apply-combine](https://r-cubed-intro.rostools.org/sessions/data-management.html#split-apply-combine-summarizing-data) technique, which we covered in the beginner R course. The method is: 1. Split the data into groups (e.g. diabetes status). @@ -502,7 +503,7 @@ technique, which we covered in the beginner R course. The method is: that you can use to make a plot or table). So when you split data into multiple groups, you make a *vector* that -you can than apply (i.e. the *map* functional) some statistical +you can then apply (i.e. the *map* functional) some statistical technique to each group through *vectorization*. This technique works really well for a range of tasks, including for our task of summarizing some of the MMASH data so we can merge it all into one dataset. @@ -760,9 +761,10 @@ With the RR dataset, each participant had almost 100,000 data points recorded over two days of collection. So if we want to join with the other datasets, we need to calculate summary measures by at least `file_path_id` and also preferably by `day` as well. In this case, we -need to `group_by()` these two variables before summarising that lets us -use the split-apply-combine technique. Let's first summarise by taking -the mean of `ibi_s` (which is the inter-beat interval in seconds): +need to `group_by()` these two variables before summarising. In this +way, we use the split-apply-combine technique. Let's first summarise by +taking the mean of `ibi_s` (which is the inter-beat interval in +seconds): ```{r} #| filename: "doc/learning.qmd" @@ -907,6 +909,14 @@ Like with the `RR.csv` dataset, let's process the `Actigraph.csv` dataset so that it makes it easier to join with the other datasets later. Make sure to read the warning block below. +::: {.callout-warning appearance="default"} +Since the `actigraph_df` dataset is quite large, we **strongly** +recommend not using `View()` or selecting the dataframe in the +Environments pane to view it. For many computers, your R session will +**crash**! Instead type out `glimpse(actigraph_df)` or simply +`actigraph_df` in the Console. +::: + 1. Like usual, create a new Markdown header called e.g. `## Exercise: Summarise Actigraph` and insert a new code chunk below that with {{< var keybind.chunk >}}. @@ -934,14 +944,6 @@ later. Make sure to read the warning block below. 10. **Add and commit** the changes you've made into the Git history with {{< var keybind.git >}}. -::: {.callout-warning appearance="default"} -Since the `actigraph_df` dataset is quite large, we **strongly** -recommend not using `View()` or selecting the dataframe in the -Environments pane to view it. For many computers, your R session will -**crash**! Instead type out `glimpse(actigraph_df)` or simply -`actigraph_df` in the Console. -::: - ```{r solution-summarise-actigraph} #| eval: true #| output: false From 367edaf385ea36d6c2ef932280c39b6c830d5a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:08:42 +0200 Subject: [PATCH 13/33] docs: add short sentence on adding headers/comments to code --- preamble/pre-course.qmd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/preamble/pre-course.qmd b/preamble/pre-course.qmd index 6acae20..5f67113 100644 --- a/preamble/pre-course.qmd +++ b/preamble/pre-course.qmd @@ -654,6 +654,14 @@ fs::file_copy( ) ``` +Notice that in the file above, we have added headers in the form of +comments to explicitly segment what is happening in the script. In +general, adding headers and comments to your code will not only help +others looking at the script for the first time, but also you in the +future, if/when you forget what was done or why it was done. It also +create sections in your code, which makes it easier to get an overview +of the code and find the relevant code. + You now have the data ready for the course! At this point, please run this function in the Console: From 91c0d8195a8516d679608e2b168deb16c9bd5b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:10:38 +0200 Subject: [PATCH 14/33] docs: put function "templete" into a code chunk to include multiline layout --- sessions/functions.qmd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 8457411..801ddf9 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -46,7 +46,12 @@ bundled sequence of steps that achieve a specific action. For instance, the `+` (to add) is a function, `mean()` is a function, `[]` (to subset or extract) is a function, and so on. In simple terms, functions are made of a function call, its arguments, and the function body: -`function(argument1, argument2) { ...body with R code... }`. + +``` {.r filename="Console"} +function(argument1, argument2){ + # body of function with R code +} +``` Because R is open source, anyone can see how things work underneath. So, if we want to see what a function does underneath, we type out the From e34c9663202315b694aac647fbb107438b21e1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:14:04 +0200 Subject: [PATCH 15/33] =?UTF-8?q?fix:=20remove=20"..."=20since=20they=20ar?= =?UTF-8?q?e=20shown=20as=20"=C2=B7=C2=B7=C2=B7"=20and=20not=20as=20regula?= =?UTF-8?q?r=20periods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sessions/functions.qmd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 801ddf9..6ad1589 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -106,13 +106,13 @@ name <- function(argument1, argument2) { ``` Writing your own functions can be absolutely amazing and fun and -powerful... but you also often want to pull your hair out with -frustration at errors that are difficult to understand and fix. The best -way to deal with this is by debugging. Due to time and to the challenge -of making meaningful debugging exercises (solutions to problems are very -dependent on the project), read @sec-extra-material in your own time for -some instructions on debugging and dealing with another common problem -you might encounter with R. +powerful, but you also often want to pull your hair out with frustration +at errors that are difficult to understand and fix. The best way to deal +with this is by debugging. Due to time and to the challenge of making +meaningful debugging exercises (solutions to problems are very dependent +on the project), read @sec-extra-material in your own time for some +instructions on debugging and dealing with another common problem you +might encounter with R. ::: Let's write a simple example. First, create a new Markdown header called @@ -136,7 +136,7 @@ your new function, with arguments to give it. add_numbers(1, 2) ``` -The function name is fairly good... `add_numbers` is read as "add +The function name is fairly good; `add_numbers` is read as "add numbers". While we generally want to write code that describes what it does by reading it, it's also good practice to add some formal documentation to the function. Use the "Insert Roxygen Skeleton" in the From 59a82b9be6a337fb67e1f428be8ef084dd615f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:14:32 +0200 Subject: [PATCH 16/33] docs: function -> code chunk --- sessions/functions.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 6ad1589..31284cb 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -117,8 +117,8 @@ might encounter with R. Let's write a simple example. First, create a new Markdown header called `## Making a function` and create a code chunk below that with -{{< var keybind.chunk >}} . Then, inside the function, we'll write this -code out: +{{< var keybind.chunk >}} . Then, inside the code chunk, we'll write +this code out: ```{r create-add-function} #| filename: "doc/learning.qmd" From c9a52baeb7eacd6b6c086c9330acff15aa459282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:15:17 +0200 Subject: [PATCH 17/33] docs: add that we should include a new header and code chunk before creating the function --- sessions/functions.qmd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 31284cb..5e4302d 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -224,6 +224,10 @@ the time throughout course and that this workflow is also what you'd use in your daily work. ::: +In `learning.qmd`, create a new Markdown header called +`## Import the user data with a function` and create a code chunk below +that with {{< var keybind.chunk >}} . + So, step one. Let's take the code we wrote for importing the `user_info` data and convert that as a function: From 9d7bfda04a845154e7fba40048630014b2449b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:16:26 +0200 Subject: [PATCH 18/33] docs: change function documentation wording to "file" since it's only for one file and not the entire dataset --- sessions/functions.qmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 5e4302d..7dca4f5 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -430,7 +430,7 @@ ___(here("data-raw/mmash/user_1/saliva.csv")) #| output: false #| code-fold: true #| code-summary: "**Click for the solution**. Only click if you are struggling or are out of time." -#' Import the MMASH saliva dataset. +#' Import the MMASH saliva file. #' #' @param file_path Path to the user saliva data file. #' @@ -782,7 +782,7 @@ ___ <- function(___) { #| output: false #| code-fold: true #| code-summary: "**Click for the solution**. Only click if you are struggling or are out of time." -#' Import the MMASH saliva dataset. +#' Import the MMASH saliva file #' #' @param file_path Path to the user saliva data file. #' @@ -803,7 +803,7 @@ import_saliva <- function(file_path) { return(saliva_data) } -#' Import the MMASH RR dataset (heart beat-to-beat interval). +#' Import the MMASH RR file (heart beat-to-beat interval). #' #' @param file_path Path to the user RR data file. #' @@ -825,7 +825,7 @@ import_rr <- function(file_path) { return(rr_data) } -#' Import the MMASH Actigraph dataset (accelerometer). +#' Import the MMASH Actigraph file (accelerometer). #' #' @param file_path Path to the user Actigraph data file. #' From 9870c8f5850fc3665282ab31d545b74f7c0994ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:17:07 +0200 Subject: [PATCH 19/33] docs: add `functionname` after `packagename::`` for clarity --- sessions/functions.qmd | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sessions/functions.qmd b/sessions/functions.qmd index 7dca4f5..b204964 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -663,9 +663,9 @@ add_numbers <- function(num1, num2) { This is *very* **bad practice** and can have some unintended and serious consequences that you might not notice or that won't give any warning or error. The correct way of indicating which package a function comes from -is instead by using `packagename::`, which you've seen and used many -times in this course. We won't get into the reasons why this is -incorrect because it can quickly get quite technical. +is instead by using `packagename::functionname`, which you've seen and +used many times in this course. We won't get into the reasons why this +is incorrect because it can quickly get quite technical. ::: {.callout-note appearance="minimal" collapse="true"} ## Instructor note @@ -678,14 +678,14 @@ hand, `library()` will throw an error if it can't find the package, which is what you expect if your code depends on a package. ::: -Another reason to use `packagename::` for each function from an R -package you use in your own function is that it explicitly tells R (and -us the readers) where the function comes from. Because the same function -name can be used by multiple packages, if you don't explicitly state -which package the function is from, R will use the function that it -finds first... which isn't always the function you meant to use. We also -do this step at the end of making the function because doing it while we -create it can be quite tedious. +Another reason to use `packagename::functionname` for each function from +an R package you use in your own function is that it explicitly tells R +(and us the readers) where the function comes from. Because the same +function name can be used by multiple packages, if you don't explicitly +state which package the function is from, R will use the function that +it finds first - which isn't always the function you meant to use. We +also do this step at the end of making the function because doing it +while we create it can be quite tedious. ::: Alright, let's go into `R/functions.R` and add `readr::` to each of the From ece2a74b61706a51308c4de1ef8581ee4c2ffe84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:18:58 +0200 Subject: [PATCH 20/33] docs: minor text edits and typo fixes --- sessions/importing.qmd | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/sessions/importing.qmd b/sessions/importing.qmd index 804c4c2..1bdb481 100644 --- a/sessions/importing.qmd +++ b/sessions/importing.qmd @@ -69,20 +69,19 @@ The learning objectives for this session are: problems when importing data (arguably one of the most important skills in any coding-type work). 3. Understand and apply best practices for importing data quickly. -4. Practice using Git version control as part of the data analysis - workflow. +4. Practice using Git version control as part of the workflow. ## Importing in the raw data The ultimate goal for the beginning phases of a data analysis project is to eventually save a version of the raw data that is specific to your -research questions. The first step to processing data is to import it -into R so we can work on it. So for now, we'll open up the -`doc/learning.qmd` file so we can start building and testing out the -code. There should be a `setup` code chunk already be in the file, where -we will put the `library()` code for loading the `{tidyverse}` package, -which has `{readr}` bundled with it, as well as `library(here)`. It -should look like this: +research questions and enables you to conduct your analyses. The first +step to processing data is to import it into R so we can work on it. So +for now, we'll open up the `doc/learning.qmd` file so we can start +building and testing out the code. There should be a `setup` code chunk +already be in the file, where we will put the `library()` code for +loading the `{tidyverse}` package, which has `{readr}` bundled with it, +as well as `library(here)`. It should look like this: ```{{r setup}} library(tidyverse) @@ -93,9 +92,9 @@ This `setup` code chunk is a special, named code chunk that tells R to run this code chunk first whenever you open this Quarto file and run code inside of the file. It's in this `setup` code chunk that we will add `library()` functions when we want to load other packages. After -adding this code chunk, create a new header by typing out -`## Importing raw data`, followed by creating a new code chunk right -below it using {{< var keybind.chunk >}}. +adding this code chunk, create a new header below the `setup` code chunk +by typing out `## Importing raw data`, followed by creating a new code +chunk right below it using {{< var keybind.chunk >}}. ::: callout-note ## Reading task: \~5 minutes @@ -341,9 +340,9 @@ user_1_info_data ## Instructor note Verbally emphasize that when you read from a larger dataset (that isn't -your project dataset), its better to *explicitly* select the columns you -want. It's faster to import and you make it clear from the beginning -which variables you want. +your project specific dataset), its better to *explicitly* select the +columns you want. It's faster to import and you make it clear from the +beginning which variables you want. ::: Why might we use `spec()` and `col_types`? It's good practice, at least From a7aff66e058c06dc3d7cce8f31ce9f0bee6a1caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:19:30 +0200 Subject: [PATCH 21/33] =?UTF-8?q?docs:=20remove=20"..."=20since=20they=20s?= =?UTF-8?q?how=20as=20"=C2=B7=C2=B7=C2=B7"=20on=20webpage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sessions/importing.qmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sessions/importing.qmd b/sessions/importing.qmd index 1bdb481..264bb1a 100644 --- a/sessions/importing.qmd +++ b/sessions/importing.qmd @@ -155,10 +155,10 @@ user_1_info_data <- read_csv(user_1_info_file) You'll see the output mention using `spec()` to use in the argument `col_types`. And that it has 5 columns, one called `...1`. If we look at -the CSV file though, we see that there are only four columns with -names... but that technically there is a first empty column without a -column header. So, let's figure out what this message means. Let's go to -the **Console** and type out: +the CSV file though, we see that there are only four columns with names, +but that technically there is a first empty column without a column +header. So, let's figure out what this message means. Let's go to the +**Console** and type out: ``` {.r filename="Console"} ?readr::spec From 0449cb24a54c7355208a41b83003e08ac497c3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:20:08 +0200 Subject: [PATCH 22/33] docs: minor text edits and typo fixes --- sessions/introduction.qmd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sessions/introduction.qmd b/sessions/introduction.qmd index f4cf7cf..534d55e 100644 --- a/sessions/introduction.qmd +++ b/sessions/introduction.qmd @@ -168,8 +168,8 @@ Our workflow and process will be something like: Because our *aim* for the R script is to produce a specific dataset output, while the *aim* of a Quarto file is to create an output *document* (like HTML) and to test reproducibility. We - use specific tools or file formats for specific purposes base on - their design. + use specific tools or file formats for specific purposes based + on their design. - Remove the old code from the Quarto document (`doc/learning.qmd`). - Once we've finished prototyping code and moved it over into a more "final" location, we remove left over code because it isn't @@ -183,7 +183,8 @@ Our workflow and process will be something like: transparent and makes it easier to share your code by uploading to GitHub. Using version control should be a standard practice to doing better science since it fits with the philosophy of - doing science. + doing science (e.g., transparency, reproducibility, and + documentation). - **Note**: While we covered GitHub in the introductory course, we can't assume everyone will have taken that course. Because of that, we won't be using GitHub in this course. From e4d914ae0c0977413cb08d11e69bbabf29839065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:31:41 +0200 Subject: [PATCH 23/33] docs: add introductory sentence to learning objectives lists so the entire section is not just a list --- sessions/dplyr-joins.qmd | 2 ++ sessions/pivots.qmd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sessions/dplyr-joins.qmd b/sessions/dplyr-joins.qmd index f029193..5c3352f 100644 --- a/sessions/dplyr-joins.qmd +++ b/sessions/dplyr-joins.qmd @@ -19,6 +19,8 @@ covering.](/images/overview-create-project-data.svg){#fig-overview-create-projec ## Learning objectives +The learning objectives of this session are: + 1. Learn what regular expressions are and how to use them on character data. 2. Learn about and apply the various ways data can be joined. diff --git a/sessions/pivots.qmd b/sessions/pivots.qmd index abc404e..5062d5e 100644 --- a/sessions/pivots.qmd +++ b/sessions/pivots.qmd @@ -27,6 +27,8 @@ and remind everyone the 'what' and 'why' of what we are doing. ## Learning objectives +The learning objective for this session is: + 1. Using the concept of "pivoting" to arrange data from long to wide and vice versa. From ab5220cb907d5bf154964b82dccc79affb67a55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:34:31 +0200 Subject: [PATCH 24/33] fix: a component -> components --- sessions/functionals.qmd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 12de125..a9907b5 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -469,8 +469,7 @@ we can move on and open up the `data-raw/mmash.R` script. Otherwise, this is a sign that there is an error in your code and that might not be reproducible. -Before -continuing, we'll move the `library(fs)` line to right below the +Before continuing, we'll move the `library(fs)` line to right below the `library(here)`. Then, inside `data-raw/mmash.R`, copy and paste the two lines of code in the code chunk above to the bottom of the script. Afterwards, go the top of the script and right below the `library(fs)` @@ -525,8 +524,8 @@ they will see how it works then. We covered this in the introduction course, so we should not cover it again here. ::: -Functionals and vectorization are an integral component of how R works -and they appear throughout many of R's functions and packages. They are +Functionals and vectorization are integral components of how R works and +they appear throughout many of R's functions and packages. They are particularly used throughout the `{tidyverse}` packages like `{dplyr}`. Let's get into some more advanced features of `{dplyr}` functions that work as functionals. Before we continue, re-run the code for getting From 500150bfd08d29bcc3a505d5d64fe4bd70cdb650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:42:36 +0200 Subject: [PATCH 25/33] docs: minor rewriting to introduce tidyselect before introducing where() --- sessions/functionals.qmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index a9907b5..7df0a6a 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -558,11 +558,11 @@ it](https://r-cubed-intro.rostools.org/sessions/data-management.html#chaining-fu from the beginner course. ::: -But many `{dplyr}` verbs can also take functions as input. When you -combine `select()` with the `where()` function, you can select different -variables. The `where()` function is a `tidyselect` helper, a set of -functions that make it easier to select variables. Some additional -helper functions are listed in @tbl-tidyselect-helpers. +But many `{dplyr}` verbs can also take functions as input. Many of such +helper functions that make it easier to select variables can be found in +`tidyselect`. When you combine `select()` with the `where()` function, +you can select different variables. Some additional helper functions are +listed in @tbl-tidyselect-helpers. ```{r tbl-tidyselect-helpers} #| echo: false From 8981d5c8e2d98e572a8917bd7a18d876a41f1ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 11:46:45 +0200 Subject: [PATCH 26/33] docs: minor re-rewrite to `tidyselect` section for a simpler sentence structure --- sessions/functionals.qmd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 7df0a6a..ab0a284 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -558,11 +558,11 @@ it](https://r-cubed-intro.rostools.org/sessions/data-management.html#chaining-fu from the beginner course. ::: -But many `{dplyr}` verbs can also take functions as input. Many of such -helper functions that make it easier to select variables can be found in -`tidyselect`. When you combine `select()` with the `where()` function, -you can select different variables. Some additional helper functions are -listed in @tbl-tidyselect-helpers. +But many `{dplyr}` verbs can also take functions as input. The +`tidyselect` package provides many of such helper functions that make it +easier to select variables. For instance, when you combine `select()` +with the `where()` function, you can easily select different variables. +Some additional helper functions are listed in @tbl-tidyselect-helpers. ```{r tbl-tidyselect-helpers} #| echo: false From 59e992b7ebb96cd08425bf5999f563e9fdb3a5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 14:03:29 +0200 Subject: [PATCH 27/33] docs: slight rewrite to make it clearer that this is something we need to do before we can use map() --- sessions/functionals.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index ab0a284..5dc712f 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -237,7 +237,7 @@ usethis::use_package("purrr") ``` Since `{purrr}` is part of the `{tidyverse}`, we don't need to load it -with `library()`. The next step for using the `map()` functional is to +with `library()`. Before we'll use the `map()` functional, we need to get a vector or list of all the dataset files available to us. We will return to using the `{fs}` package, which has a function called `dir_ls()` that finds files of a certain pattern. So, let's add From 624cd1ce4864cb9e3dc32589c19e8d57d4713387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 14:15:16 +0200 Subject: [PATCH 28/33] fix: add "using" --- sessions/functionals.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 5dc712f..9c87fbd 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -507,7 +507,7 @@ technique, which we covered in the beginner R course. The method is: that you can use to make a plot or table). So when you split data into multiple groups, you make a *vector* that -you can then apply (i.e. the *map* functional) some statistical +you can then apply (i.e. using the *map* functional) some statistical technique to each group through *vectorization*. This technique works really well for a range of tasks, including for our task of summarizing some of the MMASH data so we can merge it all into one dataset. From ccdb92b19579a6c4e1eed75313f28657cf854593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Signe=20Kirk=20Br=C3=B8db=C3=A6k?= Date: Sun, 5 May 2024 14:26:38 +0200 Subject: [PATCH 29/33] docs: slight rewrite of sentence to clarify what we're doing in the code chunk --- sessions/functionals.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 9c87fbd..78e7f47 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -744,8 +744,8 @@ saliva_df |> summarise(across(cortisol_norm, list(mean = mean))) ``` -If we wanted to do that for all numeric columns and also calculate -`sd()`: +Now, let's collect some of the concepts from above to calculate the mean +and sd for all numeric columns in the `saliva_df`: ```{r} #| filename: "doc/learning.qmd" From 9a8e954a5ec24a498b7098ec36763275b76aca5f Mon Sep 17 00:00:00 2001 From: Anders Askeland Date: Sun, 5 May 2024 16:27:23 +0200 Subject: [PATCH 30/33] Changed reduce to use saliva_with_day_df Closes #51 --- sessions/dplyr-joins.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sessions/dplyr-joins.qmd b/sessions/dplyr-joins.qmd index f029193..a068190 100644 --- a/sessions/dplyr-joins.qmd +++ b/sessions/dplyr-joins.qmd @@ -599,7 +599,7 @@ saliva_with_day_df #| filename: "doc/learning.qmd" list( user_info_df, - saliva_df, + saliva_with_day_df, summarised_rr_df, summarised_actigraph_df ) |> @@ -662,7 +662,7 @@ saliva_with_day_df <- saliva_df |> mmash <- list( user_info_df, - saliva_df, + saliva_with_day_df, summarised_rr_df, summarised_actigraph_df ) |> From e7d663b5d2ca4cc8ea126402b2fd9acb0dcaf69c Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Sun, 5 May 2024 16:32:31 +0200 Subject: [PATCH 31/33] docs: small fixes after PR edits --- preamble/pre-course.qmd | 17 +++++++++------- preamble/syllabus.qmd | 2 +- sessions/functionals.qmd | 44 +++++++++++++++++++++++----------------- sessions/functions.qmd | 2 +- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/preamble/pre-course.qmd b/preamble/pre-course.qmd index 81d5975..61313b2 100644 --- a/preamble/pre-course.qmd +++ b/preamble/pre-course.qmd @@ -676,13 +676,15 @@ fs::file_copy( ) ``` -Notice that in the file above, we have added headers in the form of -comments to explicitly segment what is happening in the script. In -general, adding headers and comments to your code will not only help -others looking at the script for the first time, but also you in the -future, if/when you forget what was done or why it was done. It also -create sections in your code, which makes it easier to get an overview -of the code and find the relevant code. +Notice that in the file above, we have added comments to help segment +sections in the code and explain what is happening in the script. In +general, adding comments to your code helps not only when others read +the script, but also you in the future, if/when you forget what was done +or why it was done. It also creates sections in your code that makes it +easier to get an overview of the code. However, there is a balance here. +Too many comments can negatively impact readability, so as much as +possible, write code in a way that explains what the code is doing, +rather than rely on comments. You now have the data ready for the course! At this point, please run this function in the Console: @@ -779,3 +781,4 @@ withr::with_dir( } ) ``` + diff --git a/preamble/syllabus.qmd b/preamble/syllabus.qmd index 5654c5f..4bb3d72 100644 --- a/preamble/syllabus.qmd +++ b/preamble/syllabus.qmd @@ -19,7 +19,7 @@ irreproducible results. With this course, we aim to begin addressing this gap. Using a highly practical approach that revolves around code-along sessions (instructor and learner coding together), hands-on exercises, and group work, -participants of the course will learn: +participants of the course will know: 1. How to demonstrate what an open and reproducible data processing and analysis workflow looks like. diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 78e7f47..ac741d2 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -124,10 +124,10 @@ the results from each function. The name `map()` doesn't mean a geographic map, it is the mathematical meaning of map: To use a function on each item in a set of items. -![A functional, map, that applies a function to each item in a vector. -Notice how each of the green coloured boxes are placed into the `func()` -function and outputs the same number of blue boxes as there are green -boxes. Modified from the [Posit purrr +![A functional, in this case `map()`, applies a function to each item in +a vector. Notice how each of the green coloured boxes are placed into +the `func()` function and outputs the same number of blue boxes as there +are green boxes. Modified from the [Posit purrr cheatsheet](https://raw.githubusercontent.com/rstudio/cheatsheets/master/purrr.pdf).](/images/functionals.png){#fig-functionals width="90%"} @@ -253,7 +253,8 @@ subfolders. We'll cover regular expressions more in the next session. In our case, the pattern is `user_info.csv`, so the code should look like this: -``` {.r filename="doc/learning.qmd"} +```{r list-user-info-files} +#| filename: "doc/learning.qmd" user_info_files <- dir_ls(here("data-raw/mmash/"), regexp = "user_info.csv", recurse = TRUE @@ -269,14 +270,15 @@ user_info_files ``` ```{r admin-list-files-for-book} +#| echo: false head(gsub(".*\\/data-raw", "data-raw", user_info_files), 3) -print("...") ``` Alright, we now have all the files ready to give to `map()`. So let's try it! -``` {.r filename="doc/learning.qmd"} +```{r} +#| filename: "doc/learning.qmd" user_info_list <- map(user_info_files, import_user_info) ``` @@ -284,13 +286,14 @@ Remember, that `map()` always outputs a list, so when we look into this object, it will give us 22 tibbles (data.frames). Here we'll only show the first one: -``` {.r filename="doc/learning.qmd"} +```{r} +#| filename: "doc/learning.qmd" user_info_list[[1]] ``` This is great because with one line of code we imported all these datasets! But we're missing an important bit of information: The user -ID. A powerful feature of the `{purrr}` package is that it gas other +ID. A powerful feature of the `{purrr}` package is that it has other functions to make it easier to work with functionals. We know `map()` always outputs a list. But what we want is a single data frame at the end that also contains the user ID information. @@ -304,7 +307,8 @@ the user ID, or in this case, the file path to the dataset, which has the user ID information in it. So, let's use it and create a new column called `file_path_id`. -``` {.r filename="doc/learning.qmd"} +```{r} +#| filename: "doc/learning.qmd" user_info_df <- map(user_info_files, import_user_info) |> list_rbind(names_to = "file_path_id") ``` @@ -369,9 +373,10 @@ works to import the other three datasets. and `import_function`. - Within the code, replace and re-write `"user_info.csv"` with `file_pattern` (this is *without* quotes around it, otherwise R - will read it as the pattern it should look for is a string with - the value "file_pattern" and not the argument `file_pattern`) - and `import_user_info` with `import_function` (also *without* + will interpret it as the pattern to look for in the `regexp` + argument, with the value `"file_pattern"` and not as the value + from `file_pattern` argument we created for our function) and + `import_user_info` with `import_function` (also *without* quotes). - Create generic intermediate objects (instead of `user_info_files` and `user_info_df`). So, replace and re-write @@ -454,7 +459,8 @@ code chunk below the `setup` chunk where we will use the `import_multiple_files()` function to import the user info and saliva data. -``` {.r filename="doc/learning.qmd"} +```{r} +#| filename: "doc/learning.qmd" user_info_df <- import_multiple_files("user_info.csv", import_user_info) saliva_df <- import_multiple_files("saliva.csv", import_saliva) ``` @@ -465,8 +471,8 @@ To test that things work, we'll create an HTML document from our Quarto document by using the "Render" / "Knit" button at the top of the pane or with {{< var keybind.render >}}. Once it creates the file, it should either pop up or open in the Viewer pane on the side. If it works, then -we can move on and open up the `data-raw/mmash.R` script. Otherwise, -this is a sign that there is an error in your code and that might not be +we can move on and open up the `data-raw/mmash.R` script. If not, it +means that there is an issue in your code and that it won't be reproducible. Before continuing, we'll move the `library(fs)` line to right below the @@ -559,8 +565,8 @@ from the beginner course. ::: But many `{dplyr}` verbs can also take functions as input. The -`tidyselect` package provides many of such helper functions that make it -easier to select variables. For instance, when you combine `select()` +`{tidyselect}` package provides many of such helper functions that make +it easier to select variables. For instance, when you combine `select()` with the `where()` function, you can easily select different variables. Some additional helper functions are listed in @tbl-tidyselect-helpers. @@ -745,7 +751,7 @@ saliva_df |> ``` Now, let's collect some of the concepts from above to calculate the mean -and sd for all numeric columns in the `saliva_df`: +and standard deviation for all numeric columns in the `saliva_df`: ```{r} #| filename: "doc/learning.qmd" diff --git a/sessions/functions.qmd b/sessions/functions.qmd index b204964..ae2c039 100644 --- a/sessions/functions.qmd +++ b/sessions/functions.qmd @@ -224,7 +224,7 @@ the time throughout course and that this workflow is also what you'd use in your daily work. ::: -In `learning.qmd`, create a new Markdown header called +In `doc/learning.qmd`, create a new Markdown header called `## Import the user data with a function` and create a code chunk below that with {{< var keybind.chunk >}} . From e58ab4ff2ed245939d134eae0906795f5a0eea57 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Sun, 5 May 2024 16:42:17 +0200 Subject: [PATCH 32/33] docs(sessions): move note about using dir_delete into intro section, rather than later Closes #66 --- sessions/dplyr-joins.qmd | 18 ------------------ sessions/functionals.qmd | 4 ---- sessions/introduction.qmd | 19 ++++++++++++++++++- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/sessions/dplyr-joins.qmd b/sessions/dplyr-joins.qmd index 5c3352f..3c4d9bf 100644 --- a/sessions/dplyr-joins.qmd +++ b/sessions/dplyr-joins.qmd @@ -629,24 +629,6 @@ library(fs) source(here("R/functions.R")) ``` -Making sure to have the `download.file()` commented out, we'll include -some code to delete the created `data-raw/mmash/` folder so this script -can run cleanly each time. Place the code right below where the -`download.file()` code is. - - - -```{r data-raw-mmash-comment-out} -#| filename: "data-raw/mmash.R" -#| eval: false -# Download -mmash_link <- "https://physionet.org/static/published-projects/mmash/multilevel-monitoring-of-activity-and-sleep-in-healthy-people-1.0.0.zip" -# download.file(mmash_link, destfile = here("data-raw/mmash-data.zip")) - -# Remove previous `mmash/` folder to have clean update -dir_delete(here("data-raw/mmash/")) -``` - Go into the `doc/learning.qmd` and cut the code used to create the `saliva_with_day_df` as well as the code to `full_join()` all the datasets together with `reduce()` and paste it at the bottom of the diff --git a/sessions/functionals.qmd b/sessions/functionals.qmd index 22174fa..8190aee 100644 --- a/sessions/functionals.qmd +++ b/sessions/functionals.qmd @@ -996,10 +996,6 @@ summarised_rr_df <- rr_df |> # Code pasted here that was made from the above exercise ``` -::: {.callout-important appearance="default"} -Do not yet `source()` or run code in this file!! -::: - Next, go to the Quarto document and again delete **everything** below the `setup` code chunk. After it has been deleted, add and commit the changes to the Git history with {{< var keybind.git >}}. diff --git a/sessions/introduction.qmd b/sessions/introduction.qmd index c37dce1..e292215 100644 --- a/sessions/introduction.qmd +++ b/sessions/introduction.qmd @@ -251,7 +251,24 @@ fs::file_delete("TODO.md") fs::file_delete("doc/report.Rmd") ``` -Then, open up the `README.md` and fix some of the TODO items. +Then, open up the `data-raw/mmash.R` file and we'll add something that +will make the rest of the course a bit easier. We'll include some code +to delete the created `data-raw/mmash/` folder so this script can run +cleanly each time. Place the code right below where the +`download.file()` code is. + + + +```{r data-raw-mmash-comment-out} +#| filename: "data-raw/mmash.R" +#| eval: false +# Download +mmash_link <- "https://physionet.org/static/published-projects/mmash/multilevel-monitoring-of-activity-and-sleep-in-healthy-people-1.0.0.zip" +# download.file(mmash_link, destfile = here("data-raw/mmash-data.zip")) + +# Remove previous `mmash/` folder to have clean update +dir_delete(here("data-raw/mmash/")) +``` ## Styling your files From 008b6d2fd3f3a15b16158748a9959f5640a74eed Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Sun, 5 May 2024 16:42:47 +0200 Subject: [PATCH 33/33] docs(slides): todo to reinstall r3 --- slides/introduction.qmd | 1 + 1 file changed, 1 insertion(+) diff --git a/slides/introduction.qmd b/slides/introduction.qmd index 54a042d..0cb2eb7 100644 --- a/slides/introduction.qmd +++ b/slides/introduction.qmd @@ -12,6 +12,7 @@ csl: includes/vancouver.csl - :heavy_check_mark: Pick a group from the basket and go to that table - :heavy_check_mark: Introduce yourself - :heavy_check_mark: Open your `LearnR3.Rproj` RStudio project +- :heavy_check_mark: Re-install r3 with `pak::pak("rostools/r3")` - :heavy_check_mark: Re-run `r3::install_packages_intermediate()` - :heavy_check_mark: Check that your `data-raw/` looks like that on the right