Skip to content

Commit

Permalink
Fix/logicals.qmd and transform.qmd; correction of fig-alt, and typos (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuoxv committed Jun 1, 2024
1 parent bc998be commit caf872c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions logicals.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ For example, `df |> filter(!is.na(x))` finds all rows where `x` is not missing a
#| circle, `y` is the right-hand circle, and the shaded regions show
#| which parts each operator selects.
#| fig-alt: |
#| Six Venn diagrams, each explaining a given logical operator. The
#| circles (sets) in each of the Venn diagrams represent x and y. 1. y &
#| !x is y but none of x; x & y is the intersection of x and y; x & !y is
#| x but none of y; x is all of x none of y; xor(x, y) is everything
#| except the intersection of x and y; y is all of y and none of x; and
#| Seven Venn diagrams, each explaining a given logical operator. The
#| circles (sets) in each of the Venn diagrams represent x and y. x &
#| !y is x but none of y; x & y is the intersection of x and y; !x & y is
#| y but none of x; x is all of x; xor(x, y) is everything
#| except the intersection of x and y; y is all of y; and
#| x | y is everything.
knitr::include_graphics("diagrams/transform.png", dpi = 270)
```
Expand Down Expand Up @@ -352,7 +352,7 @@ That leads us to the numeric summaries.
### Numeric summaries of logical vectors {#sec-numeric-summaries-of-logicals}

When you use a logical vector in a numeric context, `TRUE` becomes 1 and `FALSE` becomes 0.
This makes `sum()` and `mean()` very useful with logical vectors because `sum(x)` gives the number of `TRUE`s and `mean(x)` gives the proportion of `TRUE`s (because `mean()` is just `sum()` divided by `length()`.
This makes `sum()` and `mean()` very useful with logical vectors because `sum(x)` gives the number of `TRUE`s and `mean(x)` gives the proportion of `TRUE`s (because `mean()` is just `sum()` divided by `length()`).

That, for example, allows us to see the proportion of flights that were delayed on departure by at most an hour and the number of flights that were delayed on arrival by five hours or more:

Expand Down
2 changes: 1 addition & 1 deletion transform.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can read these chapters as you need them; they're designed to be largely sta

- @sec-logicals teaches you about logical vectors.
These are the simplest types of vectors, but are extremely powerful.
You'll learn how to create them with numeric comparisons, how to combine them with Boolean algebra, how to use them in summaries, and how to use them for condition transformations.
You'll learn how to create them with numeric comparisons, how to combine them with Boolean algebra, how to use them in summaries, and how to use them for conditional transformations.

- @sec-numbers dives into tools for vectors of numbers, the powerhouse of data science.
You'll learn more about counting and a bunch of important transformation and summary functions.
Expand Down

0 comments on commit caf872c

Please sign in to comment.