File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -247,9 +247,22 @@ filter_bullets <- function(cnd, ...) {
247247 index <- cnd $ dplyr_error_data $ index
248248 result <- cnd $ dplyr_error_data $ result
249249
250- glue (
250+ bullets <- cli :: format_inline (
251251 " `..{index}` must be a logical vector, not {obj_type_friendly(result)}."
252252 )
253+
254+ if (is.data.frame(result )) {
255+ # Provide some extra advice for people who try and use `across()` inside
256+ # of `filter()`
257+ bullets <- c(
258+ bullets ,
259+ i = cli :: format_inline(
260+ " If you used {.fn across} to generate this data frame, please use {.fn if_any} or {.fn if_all} instead."
261+ )
262+ )
263+ }
264+
265+ bullets
253266}
254267
255268# ' @export
Original file line number Diff line number Diff line change 159159 i In argument: `across(everything(), ~.x > 0)`.
160160 Caused by error:
161161 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
162+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
162163
163164---
164165
170171 i In group 1: `x = 1`.
171172 Caused by error:
172173 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
174+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
173175
174176---
175177
181183 i In row 1.
182184 Caused by error:
183185 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
186+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
184187
185188---
186189
191194 i In argument: `tibble(x > 0, y > 0)`.
192195 Caused by error:
193196 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
197+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
194198
195199---
196200
202206 i In group 1: `x = 1`.
203207 Caused by error:
204208 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
209+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
205210
206211---
207212
213218 i In row 1.
214219 Caused by error:
215220 ! `..1` must be a logical vector, not a <tbl_df/tbl/data.frame> object.
221+ i If you used `across()` to generate this data frame, please use `if_any()` or `if_all()` instead.
216222
217223# ` filter() ` doesn't allow data frames with missing or empty names (#6758 )
218224
You can’t perform that action at this time.
0 commit comments