Skip to content

Commit

Permalink
Use dplyr 1.1 'default' parameter in 'case_when()' (#1525)
Browse files Browse the repository at this point in the history
* Use dplyr 1.1 'default' parameter in 'case_when()'

* Update logicals.qmd

---------

Co-authored-by: Hadley Wickham <[email protected]>
  • Loading branch information
hdigital and hadley authored Jul 16, 2023
1 parent c1e1437 commit be5039f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions logicals.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "???"
)
```

Expand Down

0 comments on commit be5039f

Please sign in to comment.