Skip to content

Commit 2e377e7

Browse files
committed
NEWS bullet
1 parent 4901aa4 commit 2e377e7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

NEWS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# dplyr (development version)
22

3+
* New experimental `filter_out()` companion to `filter()`.
4+
5+
* Use `filter()` when specifying rows to _keep_.
6+
7+
* Use `filter_out()` when specifying rows to _drop_.
8+
9+
`filter_out()` simplifies cases where you would have previously used a `filter()` to drop rows. It is particularly useful when missing values are involved. For example, to drop rows where the `count` is zero:
10+
11+
```r
12+
df |> filter(count != 0 | !is.na(count))
13+
14+
df |> filter_out(count == 0)
15+
```
16+
17+
With `filter()`, you must provide a "negative" condition of `!= 0` and must explicitly guard against accidentally dropping rows with `NA`. With `filter_out()`, you directly specify rows to drop and you don't have to guard against dropping rows with `NA`, which tends to result in much clearer code.
18+
19+
This work is a result of [Tidyup 8: Expanding the `filter()` family](https://github.com/tidyverse/tidyups/pull/30), with a lot of great feedback from the community (#6560, #6891).
20+
321
* The `.groups` message emitted by `summarise()` is hopefully more clear now (#6986).
422

523
* `if_any()` and `if_all()` are now more consistent in all use cases (#7059, #7077, #7746, @jrwinget). In particular:

0 commit comments

Comments
 (0)