diff --git a/EDA.Rmd b/EDA.Rmd index cfb7cbf..8c934d4 100644 --- a/EDA.Rmd +++ b/EDA.Rmd @@ -247,7 +247,7 @@ If you've encountered unusual values in your dataset, and simply want to move on mutate(y = ifelse(y < 3 | y > 20, NA, y)) ``` -`ifelse()` has three arguments. The first argument `test` should be a logical vector. The result will contain the value of the second argument, `yes`, when `test` is `TRUE`, and the value of the third argument, `no`, when it is false. +`ifelse()` has three arguments. The first argument `test` should be a logical vector. The result will contain the value of the second argument, `yes`, when `test` is `TRUE`, and the value of the third argument, `no`, when it is false. Alternatively to ifelse, use `dplyr::case_when()`. `case_when()` is particularly useful inside mutate when you want to create a new variable that relies on a complex combination of existing variables. Like R, ggplot2 subscribes to the philosophy that missing values should never silently go missing. It's not obvious where you should plot missing values, so ggplot2 doesn't include them in the plot, but it does warn that they've been removed: