From d4ed726e71078a19482769ef40227e94851124b6 Mon Sep 17 00:00:00 2001 From: Carrie Wright <23014755+carriewright11@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:13:18 -0600 Subject: [PATCH 1/2] adding more of they why --- .../Subsetting_Data_in_R.Rmd | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd index 5f260c1e..e96fd2da 100644 --- a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd +++ b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd @@ -28,7 +28,7 @@ We are constantly making improvements. - The sequence `seq()` function helps you create numeric vectors (`from`,`to`, `by`, and `length.out` arguments) - The repeat `rep()` function helps you create vectors with the `each` and `times` arguments - Reproducible science makes everyone's life easier! -- `readr`has helpful functions like `read_csv()` that can help you import data into R +- The `readr` package has helpful functions like `read_csv()` that can help you import data into R 📃 [Day 2 Cheatsheet](https://daseh.org/modules/cheatsheets/Day-2.pdf) @@ -204,6 +204,14 @@ head(er) # Renaming Columns +## Why rename? + +Renaming can: + +- make it easier to work with your data +- make your column names more compaitible with R +- make your column names more interpretable by others + ## `rename` function ```{r, fig.alt="dplyr", out.width = "70%", echo = FALSE, fig.align='center'} @@ -414,6 +422,20 @@ C. Keeping it as is and use quotes around the column name when you use it. # Subsetting Columns +## Why Subset? + +Subsetting involves grabbing specific parts of your data to eith : + +- Produce a smaller dataset +- Examine specific subsets of your data +- Use a particular part of the data for a specific analysis/visualzation + + +Be cautious about removing columns/variables as you might find they are useful later. + +You should be guided by your questions of interest. + + ## Let's get our data again We'll work with the CO heat-related ER visits dataset again. From 87e03eecf952ff262213db91e6b4f77fbdd3ccab Mon Sep 17 00:00:00 2001 From: Carrie Wright <23014755+carriewright11@users.noreply.github.com> Date: Wed, 10 Jun 2026 11:14:33 -0600 Subject: [PATCH 2/2] Apply suggestion from @carriewright11 --- modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd index e96fd2da..aa29783c 100644 --- a/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd +++ b/modules/Subsetting_Data_in_R/Subsetting_Data_in_R.Rmd @@ -424,7 +424,7 @@ C. Keeping it as is and use quotes around the column name when you use it. ## Why Subset? -Subsetting involves grabbing specific parts of your data to eith : +Subsetting involves grabbing specific parts of your data to: - Produce a smaller dataset - Examine specific subsets of your data