dplyr icon indicating copy to clipboard operation
dplyr copied to clipboard

Deprecate support for filter(, <matrix with 1 column>)

Open romainfrancois opened this issue 4 years ago • 1 comments

in https://github.com/tidyverse/dplyr/pull/6083 we've let filter() handle matrices of 1 column for the time being. At some point this should warn, and then error.

Packages currently concerned:

  • egor: https://github.com/tilltnet/egor/issues/76
  • ggcharts: https://github.com/thomas-neitmann/ggcharts/pull/100
  • janitor: https://github.com/sfirke/janitor/pull/463
  • Momocs: https://github.com/MomX/Momocs/pull/222
  • MRFcov: https://github.com/nicholasjclark/MRFcov/pull/32
  • multifear: https://github.com/AngelosPsy/multifear/pull/10
  • psfmi: https://github.com/mwheymans/psfmi/pull/5
  • psycModel: https://github.com/jasonmoy28/psycModel/pull/8
  • tangram.pipe
  • TeachHist
  • validata
  • xpose

romainfrancois avatar Nov 17 '21 17:11 romainfrancois

Minimal reprex:

library(dplyr, warn.conflicts = FALSE)

df <- tibble(x = 1:2, y = matrix(1:2, ncol = 1))
filter(df, y > 1)
#> # A tibble: 1 × 2
#>       x y[,1]
#>   <int> <int>
#> 1     2     2

df <- tibble(x = 1:2, y = matrix(1:2, ncol = 2))
filter(df, y > 1)
#> Error in `filter()`:
#> ! Problem while computing `..1 = y > 1`.
#> ✖ Input `..1` must be a logical vector, not a logical[,2].

Created on 2022-07-21 by the reprex package (v2.0.1)

hadley avatar Jul 21 '22 21:07 hadley

Slightly tricky because need to generate deprecation in C: https://github.com/tidyverse/dplyr/blob/main/src/filter.cpp#L67-L73

When fixing, should also update the other deprecations to use lifecycle: https://github.com/tidyverse/dplyr/blob/main/src/filter.cpp#L120-L125.

hadley avatar Aug 18 '22 16:08 hadley