Skip to content

make_splits() does not work on empty assessment indices #188

@tjmahr

Description

@tjmahr

If you are filing a bug, make sure these boxes are checked before submitting your issue— thank you!

  • Start a new R session
  • Install the latest version of of the package: update.packages(oldPkgs="rsample", ask=FALSE)
  • Write a minimal reproducible example
  • run sessionInfo() and add the results to the issue. Even better would be to use the sessioninfo package's session_info().

Minimal, reproducible example:

I am trying to make my own rset function for bootstrap sampling groups in a grouped dataframes. But I run into an issue when the assessment rows empty. When making the reprex, I also discovered that I had to use 5L instead of 5 for the index.

rsample::make_splits(
  list(
    analysis = 1:5,
    assessment = NA
  ),
  data.frame(x = 1:5)
)
#> Error in UseMethod("complement"): no applicable method for 'complement' applied to an object of class "rsplit"

rsample::make_splits(
  list(
    analysis = 1:5,
    assessment = integer(0)
  ),
  data.frame(x = 1:5)
)
#> Error in UseMethod("complement"): no applicable method for 'complement' applied to an object of class "rsplit"

rsample::make_splits(
  list(
    analysis = 1:4,
    assessment = 5
  ),
  data.frame(x = 1:5)
)
#> Error: `out_id` must be a positive integer vector.

rsample::make_splits(
  list(
    analysis = 1:4,
    assessment = 5L
  ),
  data.frame(x = 1:5)
)
#> <Analysis/Assess/Total>
#> <4/1/5>

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

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.2 (2020-06-22)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/Chicago             
#>  date     2020-09-25                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source                            
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.2)                    
#>  backports     1.1.10  2020-09-15 [1] CRAN (R 4.0.2)                    
#>  callr         3.4.4   2020-09-07 [1] CRAN (R 4.0.2)                    
#>  cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.2)                    
#>  codetools     0.2-16  2018-12-24 [1] CRAN (R 4.0.0)                    
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.2)                    
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.2)                    
#>  devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.2)                    
#>  digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.2)                    
#>  dplyr         1.0.2   2020-08-18 [1] CRAN (R 4.0.2)                    
#>  ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.2)                    
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.2)                    
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.2)                    
#>  fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.2)                    
#>  furrr         0.1.0   2018-05-16 [1] CRAN (R 4.0.2)                    
#>  future        1.19.1  2020-09-22 [1] CRAN (R 4.0.2)                    
#>  generics      0.0.2   2018-11-29 [1] CRAN (R 4.0.2)                    
#>  globals       0.13.0  2020-09-17 [1] CRAN (R 4.0.2)                    
#>  glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.2)                    
#>  highr         0.8     2019-03-20 [1] CRAN (R 4.0.2)                    
#>  htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.2)                    
#>  knitr         1.30    2020-09-22 [1] CRAN (R 4.0.2)                    
#>  lifecycle     0.2.0   2020-03-06 [1] CRAN (R 4.0.2)                    
#>  listenv       0.8.0   2019-12-05 [1] CRAN (R 4.0.2)                    
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.2)                    
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.2)                    
#>  pillar        1.4.6   2020-07-10 [1] CRAN (R 4.0.2)                    
#>  pkgbuild      1.1.0   2020-07-13 [1] CRAN (R 4.0.2)                    
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.2)                    
#>  pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.2)                    
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.2)                    
#>  processx      3.4.4   2020-09-03 [1] CRAN (R 4.0.2)                    
#>  ps            1.3.4   2020-08-11 [1] CRAN (R 4.0.2)                    
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.2)                    
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.2)                    
#>  remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.2)                    
#>  rlang         0.4.7   2020-07-09 [1] CRAN (R 4.0.2)                    
#>  rmarkdown     2.3.2   2020-07-06 [1] Github (rstudio/rmarkdown@ff1b279)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.2)                    
#>  rsample       0.0.8   2020-09-23 [1] CRAN (R 4.0.2)                    
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.2)                    
#>  stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.2)                    
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.2)                    
#>  testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.2)                    
#>  tibble        3.0.3   2020-07-10 [1] CRAN (R 4.0.2)                    
#>  tidyr         1.1.2   2020-08-27 [1] CRAN (R 4.0.2)                    
#>  tidyselect    1.1.0   2020-05-11 [1] CRAN (R 4.0.2)                    
#>  usethis       1.6.3   2020-09-17 [1] CRAN (R 4.0.2)                    
#>  vctrs         0.3.4   2020-08-29 [1] CRAN (R 4.0.2)                    
#>  withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.2)                    
#>  xfun          0.17    2020-09-09 [1] CRAN (R 4.0.2)                    
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.0)                    
#> 
#> [1] C:/Users/Tristan/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.2/library

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions