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

prioritize() with 0-row df fails ungracefully #284

Closed
maurolepore opened this issue Sep 3, 2020 · 0 comments · Fixed by #306
Closed

prioritize() with 0-row df fails ungracefully #284

maurolepore opened this issue Sep 3, 2020 · 0 comments · Fixed by #306
Labels
bug an unexpected problem or unintended behavior

Comments

@maurolepore
Copy link
Contributor

match_name() can return a 0-row data frame. I expected prioritize() to handle such input more gracefully.

library(r2dii.data)
library(r2dii.match)

matched <- match_name(head(loanbook_demo), head(ald_demo))
#> Warning: Found no match.
identical(nrow(matched), 0L)
#> [1] TRUE

# Fails ungracefully
try(prioritize(matched))
#> Error in select_chr(sort(unique(data$level)), tidyselect::matches("direct"),  : 
#>   is.character(x) is not TRUE

Created on 2020-09-03 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       Ubuntu 18.04.5 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_US:en                    
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/Chicago             
#>  date     2020-09-03                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date       lib source                             
#>  assertthat    0.2.1       2019-03-21 [1] CRAN (R 4.0.0)                     
#>  backports     1.1.9       2020-08-24 [1] RSPM (R 4.0.2)                     
#>  callr         3.4.3       2020-03-28 [1] CRAN (R 4.0.0)                     
#>  cli           2.0.2       2020-02-28 [1] CRAN (R 4.0.0)                     
#>  crayon        1.3.4.9000  2020-08-06 [1] Github (r-lib/crayon@dcf6d44)      
#>  data.table    1.13.0      2020-07-24 [1] RSPM (R 4.0.2)                     
#>  desc          1.2.0       2018-05-01 [1] CRAN (R 4.0.0)                     
#>  devtools      2.3.1.9000  2020-08-18 [1] Github (r-lib/devtools@df619ce)    
#>  digest        0.6.25      2020-02-23 [1] CRAN (R 4.0.0)                     
#>  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.0)                     
#>  evaluate      0.14        2019-05-28 [1] CRAN (R 4.0.0)                     
#>  fansi         0.4.1       2020-01-08 [1] CRAN (R 4.0.0)                     
#>  fs            1.5.0       2020-07-31 [1] RSPM (R 4.0.2)                     
#>  generics      0.0.2       2018-11-29 [1] CRAN (R 4.0.0)                     
#>  glue          1.4.2       2020-08-27 [1] RSPM (R 4.0.2)                     
#>  highr         0.8         2019-03-20 [1] CRAN (R 4.0.0)                     
#>  htmltools     0.5.0       2020-06-16 [1] CRAN (R 4.0.0)                     
#>  knitr         1.29        2020-06-23 [1] RSPM (R 4.0.2)                     
#>  lifecycle     0.2.0       2020-03-06 [1] CRAN (R 4.0.0)                     
#>  magrittr      1.5.0.9000  2020-08-31 [1] Github (tidyverse/magrittr@15f6f07)
#>  memoise       1.1.0       2017-04-21 [1] CRAN (R 4.0.0)                     
#>  pillar        1.4.6       2020-07-10 [1] CRAN (R 4.0.0)                     
#>  pkgbuild      1.1.0       2020-07-13 [1] RSPM (R 4.0.2)                     
#>  pkgconfig     2.0.3       2019-09-22 [1] CRAN (R 4.0.0)                     
#>  pkgload       1.1.0       2020-05-29 [1] CRAN (R 4.0.0)                     
#>  prettyunits   1.1.1       2020-01-24 [1] CRAN (R 4.0.0)                     
#>  processx      3.4.3       2020-07-05 [1] RSPM (R 4.0.2)                     
#>  ps            1.3.4       2020-08-11 [1] CRAN (R 4.0.0)                     
#>  purrr         0.3.4       2020-04-17 [1] CRAN (R 4.0.0)                     
#>  r2dii.data  * 0.1.2       2020-08-04 [1] RSPM (R 4.0.2)                     
#>  r2dii.match * 0.0.4       2020-08-13 [1] RSPM (R 4.0.2)                     
#>  R6            2.4.1       2019-11-12 [1] CRAN (R 4.0.0)                     
#>  remotes       2.2.0       2020-07-21 [1] RSPM (R 4.0.2)                     
#>  rlang         0.4.7       2020-07-09 [1] CRAN (R 4.0.0)                     
#>  rmarkdown     2.3         2020-06-18 [1] CRAN (R 4.0.0)                     
#>  rprojroot     1.3-2       2018-01-03 [1] CRAN (R 4.0.0)                     
#>  sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 4.0.0)                     
#>  stringdist    0.9.6       2020-07-16 [1] RSPM (R 4.0.2)                     
#>  stringi       1.4.6       2020-02-17 [1] CRAN (R 4.0.0)                     
#>  stringr       1.4.0       2019-02-10 [1] CRAN (R 4.0.0)                     
#>  testthat      2.99.0.9000 2020-08-18 [1] Github (r-lib/testthat@9e643d8)    
#>  tibble        3.0.3       2020-07-10 [1] CRAN (R 4.0.0)                     
#>  tidyr         1.1.2       2020-08-27 [1] RSPM (R 4.0.2)                     
#>  tidyselect    1.1.0       2020-05-11 [1] CRAN (R 4.0.0)                     
#>  usethis       1.6.1       2020-04-29 [1] RSPM (R 4.0.2)                     
#>  vctrs         0.3.4       2020-08-29 [1] RSPM (R 4.0.2)                     
#>  withr         2.2.0       2020-04-20 [1] CRAN (R 4.0.0)                     
#>  xfun          0.16        2020-07-24 [1] RSPM (R 4.0.2)                     
#>  yaml          2.2.1       2020-02-01 [1] CRAN (R 4.0.0)                     
#> 
#> [1] /home/mauro/R/x86_64-pc-linux-gnu-library/4.0
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library
@maurolepore maurolepore added the bug an unexpected problem or unintended behavior label Sep 3, 2020
maurolepore added a commit to maurolepore/r2dii.match that referenced this issue Sep 30, 2020
Closes RMI-PACTA#284

If prioritize gets a 0-row input, it has nothing to prioritize, so
it returns its input untouched. And in this case, handling other
issues is not the business of prioritize().
maurolepore added a commit to maurolepore/r2dii.match that referenced this issue Sep 30, 2020
Closes RMI-PACTA#284

If prioritize gets a 0-row input, it has nothing to prioritize, so
it returns its input untouched. And in this case, handling other
issues is not the business of prioritize().
maurolepore added a commit that referenced this issue Oct 1, 2020
Closes #284

If prioritize gets a 0-row input, it has nothing to prioritize, so
it returns its input untouched. And in this case, handling other
issues is not the business of prioritize().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant