Error in running a random forest example using tidymodels

Hi all, I came across the new frontpage of tidymodels and wanted to run the example and go from there but I'm getting stuck on the random forest classification example. This is straight from https://www.tidymodels.org/start/resampling/. Here is my session info and the reprex:

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
 [1] reprex_0.3.0     forcats_0.5.0    stringr_1.4.0    readr_1.3.1      tidyr_1.0.2      tidyverse_1.3.0  modeldata_0.0.1  yardstick_0.0.6 
 [9] workflows_0.1.1  tune_0.1.0       tibble_3.0.1     rsample_0.0.6    recipes_0.1.12   purrr_0.3.4      parsnip_0.1.0    infer_0.5.1     
[17] ggplot2_3.3.0    dplyr_0.8.5      dials_0.0.6      scales_1.1.0     broom_0.5.6      tidymodels_0.1.0

loaded via a namespace (and not attached):
  [1] readxl_1.3.1        backports_1.1.6     tidytext_0.2.4      plyr_1.8.6          igraph_1.2.5        splines_4.0.0       crosstalk_1.1.0.1  
  [8] listenv_0.8.0       SnowballC_0.7.0     rstantools_2.0.0    inline_0.3.15       digest_0.6.25       foreach_1.5.0       htmltools_0.4.0    
 [15] rsconnect_0.8.16    fansi_0.4.1         magrittr_1.5        globals_0.12.5      modelr_0.1.7        gower_0.2.1         matrixStats_0.56.0 
 [22] xts_0.12-0          prettyunits_1.1.1   colorspace_1.4-1    rvest_0.3.5         haven_2.2.0         xfun_0.13           jsonlite_1.6.1     
 [29] callr_3.4.3         crayon_1.3.4        lme4_1.1-23         survival_3.1-12     zoo_1.8-7           iterators_1.0.12    glue_1.4.0         
 [36] gtable_0.3.0        ipred_0.9-9         clipr_0.7.0         pkgbuild_1.0.7      rstan_2.19.3        DBI_1.1.0           miniUI_0.1.1.1     
 [43] Rcpp_1.0.4.6        xtable_1.8-4        GPfit_1.0-8         stats4_4.0.0        lava_1.6.7          StanHeaders_2.19.2  prodlim_2019.11.13 
 [50] DT_0.13             httr_1.4.1          htmlwidgets_1.5.1   threejs_0.3.3       ellipsis_0.3.0      farver_2.0.3        pkgconfig_2.0.3    
 [57] loo_2.2.0           nnet_7.3-13         dbplyr_1.4.3        utf8_1.1.4          labeling_0.3        tidyselect_1.0.0    rlang_0.4.5        
 [64] DiceDesign_1.8-1    reshape2_1.4.4      later_1.0.0         cellranger_1.1.0    munsell_0.5.0       tools_4.0.0         cli_2.0.2          
 [71] generics_0.0.2      ggridges_0.5.2      evaluate_0.14       fastmap_1.0.1       yaml_2.2.1          fs_1.4.1            processx_3.4.2     
 [78] knitr_1.28          future_1.17.0       nlme_3.1-147        whisker_0.4         mime_0.9            rstanarm_2.19.3     xml2_1.3.1         
 [85] tokenizers_0.2.1    compiler_4.0.0      bayesplot_1.7.1     shinythemes_1.1.2   rstudioapi_0.11     curl_4.3            tidyposterior_0.0.2
 [92] lhs_1.0.2           statmod_1.4.34      stringi_1.4.6       ps_1.3.2            lattice_0.20-41     Matrix_1.2-18       nloptr_1.2.2.1     
 [99] markdown_1.1        shinyjs_1.1         vctrs_0.2.4         pillar_1.4.3        lifecycle_0.2.0     furrr_0.1.0         httpuv_1.5.2       
[106] R6_2.4.1            promises_1.1.0      gridExtra_2.3       janeaustenr_0.1.5   codetools_0.2-16    boot_1.3-24         colourpicker_1.0   
[113] MASS_7.3-51.5       gtools_3.8.2        assertthat_0.2.1    withr_2.2.0         shinystan_2.5.0     hms_0.5.3           parallel_4.0.0     
[120] grid_4.0.0          rpart_4.1-15        timeDate_3043.102   class_7.3-16        minqa_1.2.4         rmarkdown_2.1       pROC_1.16.2        
[127] tidypredict_0.4.5   shiny_1.4.0.2       lubridate_1.7.8     base64enc_0.1-3     dygraphs_1.1.1.6 

Fixed it by installing "ranger" package (still, that doesn't sound like the proper way to get started with tidymodels...)

When you use set_engine("ranger"), you're telling it to use the ranger package, which is why you needed to install it! See the set_engine() function reference in parsnip for (slightly) more details.

Feel free to file an issue, though, if you think that's not coming through loud and clear in the documentation.

This is fixed in the devel version of parsnip.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.