Skip to content

Commit a16bc3e

Browse files
Merge pull request #339 from UBC-DSCI/bugfixing
Fixing tables in wrangling
2 parents bf61fd1 + 63bd6ea commit a16bc3e

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

img/pivot_functions.key

217 Bytes
Binary file not shown.
-577 Bytes
Loading

wrangling.Rmd

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ been met:
399399

400400
Suppose we have observations spread across multiple rows rather than in a single \index{pivot\_wider}
401401
row. For example, in Figure \@ref(fig:long-to-wide), the table on the left is in an
402-
untidy, long format because the `count` column contains two variables
403-
(population and commuter count) and information about each observation
404-
(here, population and commuter counts for a region) is split across two rows.
402+
untidy, long format because the `count` column contains three variables
403+
(population, commuter, and incorporated count) and information about each observation
404+
(here, population, commuter, and incorporated counts for a region) is split across three rows.
405405
Remember: one of the criteria for tidy data
406406
is that each observation must be in a single row.
407407

@@ -413,8 +413,7 @@ before the maximum can be computed.
413413
In comparison, if the data were tidy,
414414
all we would have to do is compute the maximum value for the commuter column.
415415
To reshape this untidy data set to a tidy (and in this case, wider) format,
416-
we need to create a column called "population"
417-
and a column called "commuters."
416+
we need to create a column called "population", "commuters", and "incorporated."
418417
This is illustrated in the right table of Figure \@ref(fig:long-to-wide).
419418

420419
``` {r long-to-wide, echo = FALSE, message = FALSE, warning = FALSE, fig.cap = "Going from long to wide data.", fig.retina = 2, out.width = "100%"}

0 commit comments

Comments
 (0)