Thie1e / cutpointr

Optimal cutpoints in R: determining and validating optimal cutpoints in binary classification
https://cran.r-project.org/package=cutpointr
84 stars 13 forks source link

Error in !predictor : invalid argument type #25

Closed jgarces02 closed 4 years ago

jgarces02 commented 4 years ago

Hi @Thie1e,

I'm running the example and I'm having this error, I cannot understand what I'm doing wrong... I just follow the example! Thanks!

> cp <- cutpointr(suicide, dsi, suicide, method = maximize_metric, metric = sum_sens_spec)
Assuming the positive class is yes
Assuming the positive class has higher x values
Error in !predictor : invalid argument type
Thie1e commented 4 years ago

Hi,

well, yes, that should work. Have you tried updating your packages? If it still doesn't work then, can you post the output of sessionInfo()?

Thie1e commented 4 years ago

...and can you perhaps post the output of the current sessionInfo() before updating? I'm suspecting that this is caused by an outdated package from the tidyverse or tidyeval. I'd update the description file accordingly then, if that's the case.

jgarces02 commented 4 years ago

Thanks for so quick response! Sorry, but I've just restarted my session :sweat:... anyway, my new (after updating some packages) sessionInfo() is the following:

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252    LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Spanish_Spain.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] cutpointr_1.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2       codetools_0.2-16 tidyr_1.0.2      fansi_0.4.0      utf8_1.1.4       foreach_1.4.4    crayon_1.3.4    
 [8] dplyr_0.8.5      assertthat_0.2.1 R6_2.4.0         lifecycle_0.1.0  magrittr_1.5     pillar_1.4.1     cli_1.1.0       
[15] rlang_0.4.5      rstudioapi_0.10  vctrs_0.2.4      iterators_1.0.10 tools_3.6.0      glue_1.3.1       purrr_0.3.2     
[22] compiler_3.6.0   pkgconfig_2.0.2  tidyselect_0.2.5 tibble_2.1.3   

Now, I've got another error: Error: 'vec_dim' is not an exported object from 'namespace:vctrs'... if doing cp itself, summary(cp) works well.

Thanks again for your help!

Thie1e commented 4 years ago

This somehow has to do with vctrs, tibble or any of the related packages, if it only occurs when trying to print the tibble. I've got later versions of most of the packages, but only minor updates. The only big difference to my setup that I noticed is tidyselect which is currently on 1.0.0.

I could not reproduce the error when downgrading to tidyselect 0.2.5, but can you try updating tidyselect anyway?

Thie1e commented 4 years ago

...after reading https://github.com/r-lib/vctrs/issues/487 this may be caused by pillar 1.4.1. Can you try updating that?

jgarces02 commented 4 years ago

Perfect, installing pillar works nice. Thanks a lot!