Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds S3 registration #1

Merged
merged 1 commit into from Sep 8, 2020
Merged

Adds S3 registration #1

merged 1 commit into from Sep 8, 2020

Conversation

topepo
Copy link
Contributor

@topepo topepo commented Sep 8, 2020

Makes sure that the tunable() method for the step is seen during method dispatch on R >= 4.0. That version had the change that

S3 method lookup now by default skips the elements of the search path between the global and base environments.

Since your package is defining a method for a generic that lives in the recipes package, this extra bit of code is needed.

library(stepdwt)
#> Loading required package: recipes
#> Loading required package: 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
#> 
#> Attaching package: 'recipes'
#> The following object is masked from 'package:stats':
#> 
#>     step
library(tune)

rec <- recipe( ~ ., data = USArrests)
dwt_trans <- rec %>%
  step_center(all_numeric()) %>%
  step_scale(all_numeric()) %>%
  step_dwt(all_numeric(), filter = tune())

tunable(dwt_trans)
#> # A tibble: 1 x 5
#>   name   call_info        source component component_id
#>   <chr>  <list>           <chr>  <chr>     <chr>       
#> 1 filter <named list [2]> recipe step_dwt  dwt_XOaCE

Created on 2020-09-08 by the reprex package (v0.3.0)

@mattsq mattsq merged commit a41cffd into mattsq:master Sep 8, 2020
@mattsq
Copy link
Owner

@mattsq mattsq commented Sep 8, 2020

Awesome, thanks Max!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants