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

Main functions doesn't do any input checking on data argument #474

Open
EmilHvitfeldt opened this issue May 5, 2024 · 0 comments
Open
Labels
feature a feature request or enhancement

Comments

@EmilHvitfeldt
Copy link
Member

sooo, there isn't much input checking for some of the main functions here in {rsample}, to the point of bootstraps(bootstraps) not returning an error 😬

bootstraps

library(rsample)

mat_cars <- as.matrix(mtcars)

bootstraps(mat_cars, times = 2)
#> # Bootstrap sampling 
#> # A tibble: 2 × 2
#>   splits          id        
#>   <list>          <chr>     
#> 1 <split [32/11]> Bootstrap1
#> 2 <split [32/11]> Bootstrap2

bootstraps(1:10, times = 2)
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

bootstraps(NULL)
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

bootstraps(lm(mpg ~ disp, data = mtcars))
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

vfold_cv

library(rsample)

mat_cars <- as.matrix(mtcars)

vfold_cv(mat_cars)
#> #  10-fold cross-validation 
#> # A tibble: 10 × 2
#>    splits         id    
#>    <list>         <chr> 
#>  1 <split [28/4]> Fold01
#>  2 <split [28/4]> Fold02
#>  3 <split [29/3]> Fold03
#>  4 <split [29/3]> Fold04
#>  5 <split [29/3]> Fold05
#>  6 <split [29/3]> Fold06
#>  7 <split [29/3]> Fold07
#>  8 <split [29/3]> Fold08
#>  9 <split [29/3]> Fold09
#> 10 <split [29/3]> Fold10

vfold_cv(1:10)
#> Error in if (v > max_v) {: argument is of length zero

vfold_cv(NULL)
#> Error in if (v > max_v) {: argument is of length zero

vfold_cv(lm(mpg ~ disp, data = mtcars))
#> Error in if (v > max_v) {: argument is of length zero
@EmilHvitfeldt EmilHvitfeldt added the feature a feature request or enhancement label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant