@@ -310,7 +310,7 @@ when we need to make the data frame longer and narrower.
310
310
To learn how to use ` pivot_longer ` , we will work through an example with the
311
311
` region_lang_top5_cities_wide.csv ` data set. This data set contains the
312
312
counts of how many Canadians cited each language as their mother tongue for five
313
- major Canadian cities (Toronto, Montréal, Vancouver, Calgary and Edmonton) from
313
+ major Canadian cities (Toronto, Montréal, Vancouver, Calgary, and Edmonton) from
314
314
the 2016 Canadian census. \index{Canadian languages}
315
315
To get started,
316
316
we will load the ` tidyverse ` package and use ` read_csv ` to load the (untidy) data.
@@ -326,7 +326,7 @@ What is wrong with the untidy format above?
326
326
The table on the left in Figure \@ ref(fig: img-pivot-longer-with-table )
327
327
represents the data in the "wide" (messy) format.
328
328
From a data analysis perspective, this format is not ideal because the values of
329
- the variable * region* (Toronto, Montréal, Vancouver, Calgary and Edmonton)
329
+ the variable * region* (Toronto, Montréal, Vancouver, Calgary, and Edmonton)
330
330
are stored as column names. Thus they
331
331
are not easily accessible to the data analysis functions we will apply
332
332
to our data set. Additionally, the * mother tongue* variable values are
@@ -428,7 +428,7 @@ we will work through an example
428
428
with the ` region_lang_top5_cities_long.csv ` data set.
429
429
This data set contains the number of Canadians reporting
430
430
the primary language at home and work for five
431
- major cities (Toronto, Montréal, Vancouver, Calgary and Edmonton).
431
+ major cities (Toronto, Montréal, Vancouver, Calgary, and Edmonton).
432
432
433
433
``` {r 02-reading-long, warning=FALSE, message=FALSE, R.options = list(width = 90)}
434
434
lang_long <- read_csv("data/region_lang_top5_cities_long.csv")
@@ -496,7 +496,7 @@ more columns, and we would see the data set "widen."
496
496
497
497
Data are also not considered tidy when multiple values are stored in the same \index{separate}
498
498
cell. The data set we show below is even messier than the ones we dealt with
499
- above: the ` Toronto ` , ` Montréal ` , ` Vancouver ` , ` Calgary ` and ` Edmonton ` columns
499
+ above: the ` Toronto ` , ` Montréal ` , ` Vancouver ` , ` Calgary ` , and ` Edmonton ` columns
500
500
contain the number of Canadians reporting their primary language at home and
501
501
work in one column separated by the delimiter (` / ` ). The column names are the \index{delimiter}
502
502
values of a variable, * and* each value does not have its own cell! To turn this
0 commit comments