Use dplyr 1.1 'default' parameter in 'case_when()' (#1525)
* Use dplyr 1.1 'default' parameter in 'case_when()' * Update logicals.qmd --------- Co-authored-by: Hadley Wickham <hadley@posit.co>
This commit is contained in:
@@ -494,13 +494,13 @@ case_when(
|
||||
)
|
||||
```
|
||||
|
||||
If you want to create a "default"/catch all value, use `TRUE` on the left hand side:
|
||||
Use `.default` if you want to create a "default"/catch all value:
|
||||
|
||||
```{r}
|
||||
case_when(
|
||||
x < 0 ~ "-ve",
|
||||
x > 0 ~ "+ve",
|
||||
TRUE ~ "???"
|
||||
.default = "???"
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user