Last updated on 2025-12-28 05:50:32 CET.
| Package | ERROR | OK |
|---|---|---|
| SHAPforxgboost | 1 | 12 |
Current CRAN status: ERROR: 1, OK: 12
Version: 0.2.0
Check: examples
Result: ERROR
Running examples in 'SHAPforxgboost-Ex.R' failed
The error most likely occurred in:
> ### Name: shap.plot.summary
> ### Title: SHAP summary plot using long-format SHAP values
> ### Aliases: shap.plot.summary
>
> ### ** Examples
>
> # Example: Basic workflow for SHAP summary plot
> # Note: For xgboost 3.x, use xgb.DMatrix + xgb.train, and convert factor labels to numeric
>
> data("iris")
> X1 = as.matrix(iris[,1:4])
> y1 = as.numeric(iris[[5]]) - 1 # Convert factor to numeric
> dtrain = xgboost::xgb.DMatrix(data = X1, label = y1)
> params = list(learning_rate = 1, min_split_loss = 0, reg_lambda = 0,
+ objective = 'reg:squarederror', nthread = 1)
> mod1 = xgboost::xgb.train(params = params, data = dtrain,
+ nrounds = 1, verbose = 0)
>
> # Get SHAP values and feature importance
> shap_values <- shap.values(xgb_model = mod1, X_train = X1)
> shap_values$mean_shap_score # Ranked features by mean|SHAP|
Petal.Length Petal.Width Sepal.Length Sepal.Width
0.6307042 0.2135736 0.0300757 0.0000000
> shap_values_iris <- shap_values$shap_score
>
> # Prepare long-format data for plotting
> shap_long_iris <- shap.prep(xgb_model = mod1, X_train = X1)
Error in `[.data.table`(fv_sub_long, , `:=`(stdfvalue, std1(rfvalue)), :
attempt access index 2/2 in VECTOR_ELT
Calls: shap.prep -> [ -> [.data.table
Execution halted
Flavor: r-devel-windows-x86_64
Version: 0.2.0
Check: re-building of vignette outputs
Result: ERROR
Error(s) in re-building vignettes:
--- re-building 'basic_workflow.Rmd' using rmarkdown
Quitting from basic_workflow.Rmd:62-87 [unnamed-chunk-3]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `[.data.table`:
! attempt access index 2/2 in VECTOR_ELT
---
Backtrace:
▆
1. └─SHAPforxgboost::shap.prep(fit, X_train = X)
2. ├─fv_sub_long[, `:=`(stdfvalue, std1(rfvalue)), by = "variable"]
3. └─data.table:::`[.data.table`(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'basic_workflow.Rmd' failed with diagnostics:
attempt access index 2/2 in VECTOR_ELT
--- failed re-building 'basic_workflow.Rmd'
SUMMARY: processing the following file failed:
'basic_workflow.Rmd'
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-windows-x86_64
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.