tidymodels / dials

Tools for creating tuning parameter values
https://dials.tidymodels.org/
Other
111 stars 26 forks source link

dplyr 1.0.0 verbs #110

Closed topepo closed 4 years ago

topepo commented 4 years ago

A number of the S3 methods for these verbs and parameter objects are broken. Some examples:

library(dials)
#> Loading required package: scales
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

grid <- parameters(penalty(), mixture())

filter(grid, id == "penalty")
#> Error: A `parameters` object has required columns.
#> Missing columns: 'name', 'id', 'source', 'component', 'component_id', 'object'

arrange(grid, id)
#> Error: arrange() failed at implicit mutate() step. 
#> x A `parameters` object has required columns.
#> Missing columns: 'name', 'id', 'source', 'component', 'component_id', 'object'

bind_cols(grid, tibble(a = 1:2))
#> Error: A `parameters` object has required columns.
#> Missing columns: 'name', 'id', 'source', 'component', 'component_id', 'object'

Created on 2020-04-19 by the reprex package (v0.3.0)

Session info ``` r devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 3.6.1 (2019-07-05) #> os macOS Mojave 10.14.6 #> system x86_64, darwin15.6.0 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2020-04-19 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0) #> backports 1.1.6 2020-04-05 [1] CRAN (R 3.6.1) #> callr 3.4.3 2020-03-28 [1] CRAN (R 3.6.2) #> cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.1) #> colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.0) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0) #> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.0) #> devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.0) #> dials * 0.0.6 2020-04-03 [1] CRAN (R 3.6.1) #> DiceDesign 1.8-1 2019-07-31 [1] CRAN (R 3.6.0) #> digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.0) #> dplyr * 0.8.99.9002 2020-04-20 [1] Github (tidyverse/dplyr@abc0934) #> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.0) #> fs 1.4.1 2020-04-04 [1] CRAN (R 3.6.1) #> generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.0) #> glue 1.4.0 2020-04-03 [1] CRAN (R 3.6.1) #> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0) #> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.0) #> knitr 1.28 2020-02-06 [1] CRAN (R 3.6.1) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.0) #> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.0) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.0) #> pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.0) #> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.0) #> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.0) #> processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.0) #> ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.0) #> purrr 0.3.3 2019-10-18 [1] CRAN (R 3.6.0) #> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.0) #> Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.6.1) #> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.0) #> rlang 0.4.5.9000 2020-04-20 [1] Github (r-lib/rlang@a90b04b) #> rmarkdown 2.1 2020-01-20 [1] CRAN (R 3.6.0) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.0) #> scales * 1.1.0 2019-11-18 [1] CRAN (R 3.6.0) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0) #> stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0) #> testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.0) #> tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.1) #> tidyselect 1.0.0 2020-01-27 [1] CRAN (R 3.6.0) #> usethis 1.5.1.9000 2020-04-09 [1] Github (r-lib/usethis@1eb8efc) #> vctrs 0.2.99.9011 2020-04-20 [1] Github (r-lib/vctrs@b17f201) #> withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.0) #> xfun 0.12 2020-01-13 [1] CRAN (R 3.6.1) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.0) #> #> [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library ```

In the new version of dplyr, see ?dplyr_extending. The changes look like they will involve calling dplyr low-level operations. For example, for data frames, the filter() method is

filter.data.frame <- function(.data, ..., .preserve = FALSE) {
  if (missing(...)) {
    return(.data)
  }
  loc <- filter_rows(.data, ...) # <- not exported!
  dplyr_row_slice(.data, loc, preserve = .preserve)
}

We will probably have to maintain S3 registration of dials methods for these verbs for both the old and new dplyr.

See tidymodels/tune#196 for where this breaks in tune. See tidyverse/dplyr#5129 for the possible need for exported functions.

JakeRuss commented 4 years ago

I have been updating my tidymodels workflow to use the new dplyr nest_by and I have walked myself right into this situation.

I volunteer to test any patches. :)

topepo commented 4 years ago

closed by #114 and #117

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.