From 9411ecd267331b82a2dae5567e5b9505acb8bbc7 Mon Sep 17 00:00:00 2001 From: Trevor Campbell Date: Fri, 22 Dec 2023 19:41:54 -0500 Subject: [PATCH] intro bug hunt r --- _bookdown.yml | 2 +- source/intro.Rmd | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_bookdown.yml b/_bookdown.yml index 67af030a1..c70f0da74 100755 --- a/_bookdown.yml +++ b/_bookdown.yml @@ -4,4 +4,4 @@ language: ui: edit: "Edit" chapter_name: "Chapter " -rmd_files: ["index.Rmd", "source/foreword.Rmd", "source/preface.Rmd", "source/acknowledgments.Rmd", "source/authors.Rmd", "source/intro.Rmd", "source/reading.Rmd", "source/wrangling.Rmd", "source/viz.Rmd", "source/classification1.Rmd", "source/classification2.Rmd", "source/regression1.Rmd", "source/regression2.Rmd", "source/clustering.Rmd", "source/inference.Rmd", "source/jupyter.Rmd", "source/version-control.Rmd", "source/setup.Rmd", "source/references.Rmd"] +rmd_files: ["index.Rmd", "source/intro.Rmd", "source/references.Rmd"] diff --git a/source/intro.Rmd b/source/intro.Rmd index b598ba9d3..4f34b568d 100644 --- a/source/intro.Rmd +++ b/source/intro.Rmd @@ -237,7 +237,7 @@ library(tidyverse) ``` > **Note:** You may have noticed that we got some extra -> output from R saying `Attaching packages` and `Conflicts` below our code +> output from R regarding attached packages and conflicts below our code > line. These are examples of *messages* in R, which give the user more > information that might be handy to know. The `Attaching packages` message is > natural when loading `tidyverse`, since `tidyverse` actually automatically @@ -452,7 +452,7 @@ selected_lang <- select(aboriginal_lang, language, mother_tongue) selected_lang ``` -## Using `arrange` to order and `slice` to select rows by index number +## Using `arrange` to order and `slice` to select rows by index number {#arrangesliceintro} We have used `filter` and `select` to obtain a table with only the Aboriginal languages in the data set and their associated counts. However, we want to know @@ -500,7 +500,7 @@ counts... But perhaps, seeing these numbers, we became curious about the *percentage* of the population of Canada associated with each count. It is common to come up with new data analysis questions in the process of answering a first one—so fear not and explore! To answer this small -question-along-the-way, we need to divide each count in the `mother_tongue` +question along the way, we need to divide each count in the `mother_tongue` column by the total Canadian population according to the 2016 census—i.e., 35,151,728—and multiply it by 100. We can perform this computation using the `mutate` function. We pass the `ten_lang` @@ -523,7 +523,7 @@ as a mother tongue by between 0.008% and 0.18% of the Canadian population. ## Exploring data with visualizations -We have now answered our initial question by generating the `ten_lang` table! +The `ten_lang` table we generated in Section \@ref(arrangesliceintro) answers our initial data analysis question. Are we done? Well, not quite; tables are almost never the best way to present the result of your analysis to your audience. Even the `ten_lang` table with only two columns presents some difficulty: for example, you have to scrutinize