Skip to content

Commit e56ccb6

Browse files
authored
logicals.qmd: use if_else() in exercises instead of ifelse() (hadley#1622)
1 parent aa5eaac commit e56ccb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

logicals.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,9 @@ We don't expect you to memorize these rules, but they should become second natur
564564
1. A number is even if it's divisible by two, which in R you can find out with `x %% 2 == 0`.
565565
Use this fact and `if_else()` to determine whether each number between 0 and 20 is even or odd.
566566

567-
2. Given a vector of days like `x <- c("Monday", "Saturday", "Wednesday")`, use an `ifelse()` statement to label them as weekends or weekdays.
567+
2. Given a vector of days like `x <- c("Monday", "Saturday", "Wednesday")`, use an `if_else()` statement to label them as weekends or weekdays.
568568

569-
3. Use `ifelse()` to compute the absolute value of a numeric vector called `x`.
569+
3. Use `if_else()` to compute the absolute value of a numeric vector called `x`.
570570

571571
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).
572572
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`.

0 commit comments

Comments
 (0)