jeffreyevans / rfUtilities

R package for random forests model selection, inference, evaluation and validation
GNU General Public License v3.0
23 stars 11 forks source link

rf.effectSize function error #6

Open ManuelSpinola opened 3 years ago

ManuelSpinola commented 3 years ago

I am trying to run the example of the rf.effectSize function but gives me an error.

library(randomForest) data(airquality) airquality <- na.omit(airquality) fit.reg <- randomForest(Ozone ~ ., data=airquality)

Parameter effect sizes

rf.effectSize(fit.reg, y = airquality$Solar.R, pred.data = airquality, x.var = Solar.R)

Error in a[[which(names(a) == "x")]] : attempt to select less than one element in get1index

jeffreyevans commented 3 years ago

Just checked the function, using the code you provided as well as running the examples and it all runs fine. Can you please send me the results of your sessionInfo() so I can see your version of R, rfUtilities and packages loaded?

Best, Jeff

Jeffrey S. Evans, Ph.D., | Senior Landscape Ecologist & Biometrician The Nature Conservancy | Protected Lands Science Visiting Professor | University of Wyoming | Zoology & Physiology Laramie, WY | @.**@.> | (970) 672-6766<tel:(970)%20672-6766>

From: ManuelSpinola @.> Sent: Wednesday, May 12, 2021 4:05 PM To: jeffreyevans/rfUtilities @.> Cc: Subscribed @.***> Subject: [jeffreyevans/rfUtilities] rf.effectSize function error (#6)

I am trying to run the example of the rf.effectSize function but gives me an error.

library(randomForest) data(airquality) airquality <- na.omit(airquality) fit.reg <- randomForest(Ozone ~ ., data=airquality)

Parameter effect sizes

rf.effectSize(fit.reg, y = airquality$Solar.R, pred.data = airquality, x.var = Solar.R)

Error in a[[which(names(a) == "x")]] : attempt to select less than one element in get1index

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/jeffreyevans/rfUtilities/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLKH77PKSLPMOCBP3UQLDTTNL3R5ANCNFSM44ZOC4DQ.

ManuelSpinola commented 3 years ago

Thank you very much Jeffrey.

sessionInfo() R version 4.0.5 (2021-03-31) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 10.16

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/POSIX/en_US.UTF-8/en_US.UTF-8

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

other attached packages: [1] rfUtilities_2.2-0 ecospat_3.2
[3] gbm_2.1.8 ape_5.5
[5] ade4_1.7-16 spatialEco_1.3-6
[7] MLeval_0.3 caret_6.0-87
[9] randomForest_4.6-14 ranger_0.12.1
[11] SDMtune_1.1.4 PointedSDMs_0.2.1.9004
[13] INLA_21.01.26 foreach_1.5.1
[15] embarcadero_1.2.0.1003 data.table_1.14.0
[17] matrixStats_0.58.0 ggpubr_0.4.0
[19] patchwork_1.1.1 ROCR_1.0-11
[21] Metrics_0.1.4 dbarts_0.9-19
[23] CAST_0.5.1 mlr_2.19.0
[25] ParamHelpers_1.14 forestError_1.0.0
[27] deepnet_0.2 kernlab_0.9-29
[29] xgboost_1.4.1.1 glmnet_4.1-1
[31] plotKML_0.8-1 geoR_1.8-1
[33] landmap_0.0.9 GADMTools_3.8-2
[35] classInt_0.4-3 geostatsp_1.8.5
[37] Matrix_1.3-3 knitr_1.33
[39] cowplot_1.1.1 maps_3.3.0
[41] mapr_0.5.2 rvertnet_0.8.0
[43] rinat_0.1.8 rgbif_3.5.2
[45] scrubr_0.3.2 spocc_1.2.0
[47] mapview_2.9.8 rgeoboundaries_0.0.0.9000 [49] dismo_1.3-3 rasterVis_0.50.2
[51] latticeExtra_0.6-29 lattice_0.20-44
[53] terra_1.2-5 raster_3.4-10
[55] rgdal_1.5-23 sp_1.4-5
[57] stars_0.5-2 abind_1.4-5
[59] sf_0.9-9 glue_1.4.2
[61] rio_0.5.26 forcats_0.5.1
[63] stringr_1.4.0 dplyr_1.0.6
[65] purrr_0.3.4 readr_1.4.0
[67] tidyr_1.1.3 tibble_3.1.1
[69] ggplot2_3.3.3 tidyverse_1.3.1

loaded via a namespace (and not attached): [1] biomod2_3.4.6 svglite_2.0.0 Hmisc_4.5-0
[4] intervals_0.15.2 class_7.3-19 crayon_1.4.1
[7] MASS_7.3-54 RSAGA_1.3.0 nlme_3.1-152
[10] backports_1.2.1 qlcMatrix_0.9.7 reprex_2.0.0
[13] maxnet_0.1.2 rlang_0.4.11 readxl_1.3.1
[16] SparseM_1.81 rjson_0.2.20 snowfall_1.84-6.1
[19] ggmap_3.0.0 splancs_2.01-42 tcltk_4.0.5
[22] haven_2.4.1 tidyselect_1.1.1 RandomFieldsUtils_0.5.3 [25] countrycode_1.2.0 XML_3.99-0.6 ENMeval_0.3.1
[28] zoo_1.8-9 gstat_2.0-7 MatrixModels_0.5-0
[31] magrittr_2.0.1 evaluate_0.14 rbison_1.0.0
[34] RgoogleMaps_1.4.5.3 cli_2.5.0 ridigbio_0.3.5
[37] rstudioapi_0.13 parallelMap_1.5.0 rebird_1.2.0
[40] whisker_0.4 rpart_4.1-15 fastmatch_1.1-0
[43] leafem_0.1.3 xfun_0.22 shapefiles_0.7
[46] cluster_2.1.2 quantreg_5.85 permute_0.9-5
[49] png_0.1-7 reshape_0.8.8 ipred_0.9-11
[52] withr_2.4.2 ecodist_2.0.7 bitops_1.0-7
[55] slam_0.1-48 plyr_1.8.6 cellranger_1.1.0
[58] sparsesvd_0.2 e1071_1.7-6 pROC_1.17.0.1
[61] pillar_1.6.0 TeachingDemos_2.12 cachem_1.0.4
[64] multcomp_1.4-17 fs_1.5.0 xts_0.12.1
[67] vctrs_0.3.8 ellipsis_0.3.2 oai_0.3.0
[70] generics_0.1.0 urltools_1.7.3 lava_1.6.9
[73] mda_0.5-2 tools_4.0.5 wellknown_0.7.2
[76] foreign_0.8-81 munsell_0.5.0 proxy_0.4-25
[79] fastmap_1.1.0 compiler_4.0.5 aqp_1.29
[82] BBmisc_1.11 rgeos_0.5-5 prodlim_2019.11.13
[85] gridExtra_2.3 rms_6.2-0 deldir_0.2-10
[88] plotmo_3.6.0 spacetime_1.2-4 utf8_1.2.1
[91] recipes_0.1.16 wk_0.4.1 jsonlite_1.7.2
[94] leafpop_0.0.6 scales_1.1.1 docopt_0.7.1
[97] carData_3.0-4 nabor_0.5.0 lazyeval_0.2.2
[100] car_3.0-10 doParallel_1.0.16 brew_1.0-6
[103] checkmate_2.0.0 sandwich_3.0-0 rmarkdown_2.8
[106] openxlsx_4.2.3 webshot_0.5.2 rosm_0.2.5
[109] survival_3.2-11 numDeriv_2016.8-1.1 yaml_2.2.1
[112] plotrix_3.8-1 systemfonts_1.0.2 conditionz_0.1.0
[115] htmltools_0.5.1.1 memoise_2.0.0 viridisLite_0.4.0
[118] digest_0.6.27 hoardr_0.5.2 assertthat_0.2.1
[121] rappdirs_0.3.3 lwgeom_0.2-6 RandomFields_3.3.8
[124] satellite_1.0.2 adehabitatMA_0.3.14 units_0.7-1
[127] adehabitatLT_0.3.25 mapproj_1.2.7 vegan_2.5-7
[130] poibin_1.5 labeling_0.4.2 splines_4.0.5
[133] Formula_1.2-4 ks_1.12.0 broom_0.7.6
[136] hms_1.0.0 modelr_0.1.8 colorspace_2.0-1
[139] base64enc_0.1-3 shape_1.4.5 nnet_7.3-16
[142] mclust_5.4.7 Rcpp_1.0.6 mvtnorm_1.1-1
[145] fansi_0.4.2 conquer_1.0.2 earth_5.3.0
[148] ModelMetrics_1.2.2.2 R6_2.5.0 grid_4.0.5
[151] crul_1.1.0 polspline_1.1.19 CircStats_0.2-6
[154] lifecycle_1.0.0 zip_2.1.1 curl_4.3.1
[157] ggsignif_0.6.1 leaflet_2.0.4.1 distill_1.2
[160] TH.data_1.0-10 RColorBrewer_1.1-2 adehabitatHR_0.4.19
[163] iterators_1.0.13 gower_0.2.2 htmlwidgets_1.5.3
[166] triebeard_0.3.0 crosstalk_1.1.1 mgcv_1.8-35
[169] rvest_1.0.0 htmlTable_2.1.0 codetools_0.2-18
[172] lubridate_1.7.10 FNN_1.1.3 leaflet.providers_1.9.0 [175] gtools_3.8.2 prettyunits_1.1.1 dbplyr_2.1.1
[178] gtable_0.3.0 DBI_1.1.1 stats4_4.0.5
[181] httr_1.4.2 KernSmooth_2.23-20 stringi_1.6.1
[184] progress_1.2.2 farver_2.1.0 reshape2_1.4.4
[187] uuid_0.1-4 hexbin_1.28.2 pixmap_0.4-12
[190] timeDate_3043.102 xml2_1.3.2 colorRamps_2.3
[193] boot_1.3-28 ggspatial_1.1.5 jpeg_0.1-8.1
[196] pkgconfig_2.0.3 maptools_1.1-1 PresenceAbsence_1.1.9
[199] rstatix_0.7.0 downlit_0.2.1 httpcode_0.3.0