diff --git a/logicals.qmd b/logicals.qmd index 254b241..7d9fb9c 100644 --- a/logicals.qmd +++ b/logicals.qmd @@ -564,9 +564,9 @@ We don't expect you to memorize these rules, but they should become second natur 1. A number is even if it's divisible by two, which in R you can find out with `x %% 2 == 0`. Use this fact and `if_else()` to determine whether each number between 0 and 20 is even or odd. -2. Given a vector of days like `x <- c("Monday", "Saturday", "Wednesday")`, use an `ifelse()` statement to label them as weekends or weekdays. +2. Given a vector of days like `x <- c("Monday", "Saturday", "Wednesday")`, use an `if_else()` statement to label them as weekends or weekdays. -3. Use `ifelse()` to compute the absolute value of a numeric vector called `x`. +3. Use `if_else()` to compute the absolute value of a numeric vector called `x`. 4. Write a `case_when()` statement that uses the `month` and `day` columns from `flights` to label a selection of important US holidays (e.g., New Years Day, 4th of July, Thanksgiving, and Christmas). First create a logical column that is either `TRUE` or `FALSE`, and then create a character column that either gives the name of the holiday or is `NA`.