How to resolve error "package ‘treeshap’ is not available for this version of R"?

69 Views Asked by At

if I try to run the treeshap function I get the following error

> TreeShapVal = treeshap(xgboost.unify(modelXG, x), x, interactions = FALSE, verbose = TRUE)
Error in treeshap(xgboost.unify(modelXG, x), x, interactions = FALSE,  : 
  could not find function "treeshap"

If I try to install the treeshap package then I get the following errors

> library(treeshap)
Error in library(treeshap) : there is no package called ‘treeshap’
> install.packages("treeshap")
Installing package into ‘C:/Users/BootMR/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘treeshap’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

I am using RStudio 2023.06. I downloaded and installed RTools last week. I have no idea how to resolve and get the treeshap package to work?

1

There are 1 best solutions below

0
PGSA On

There is no package on CRAN called treeshap, either current or in the archive. You will need to install from the github for the package. –

devtools::install_github('ModelOriented/treeshap')