Skip to contents

Given a numerical index of rownumbers of the original data, subset the correct elements of a cheem list.

Usage

subset_cheem(cheem_ls, rownumbers = 1:500)

Arguments

cheem_ls

The return of a cheem_ls() call.

rownumbers

A vector of the numeric index of rownumbers to keep. To use a logical index, pass it to which(), eg. idx <- which(mtcars$mpg > 30).

Value

A subset of the supplied cheem_ls.

See also

cheem_ls()

Other cheem preprocessing: cheem_ls()

Examples

library(cheem)

## Classification setup
X    <- spinifex::penguins_na.rm[, 1:4]
Y    <- spinifex::penguins_na.rm$species
clas <- spinifex::penguins_na.rm$species

## Cheem
peng_chm <- cheem_ls(X, Y, penguin_xgb_shap, penguin_xgb_pred, clas,
                     label = "Penguins, xgb, shapviz")
lapply(peng_chm, NROW)
#> $type
#> [1] 1
#> 
#> $model_performance
#> [1] 1
#> 
#> $attr_df
#> [1] 333
#> 
#> $global_view_df
#> [1] 999
#> 
#> $global_view_basis_ls
#> [1] 2
#> 
#> $decode_df
#> [1] 333
#> 

## subset a cheem list
num_idx <- which(spinifex::penguins_na.rm$flipper_length_mm > 185)
peng_chm_sub <- subset_cheem(peng_chm, num_idx)
lapply(peng_chm_sub, NROW)
#> $type
#> [1] 1
#> 
#> $model_performance
#> [1] 1
#> 
#> $attr_df
#> [1] 294
#> 
#> $global_view_df
#> [1] 882
#> 
#> $global_view_basis_ls
#> [1] 2
#> 
#> $decode_df
#> [1] 294
#> 
## Notice that $global_view_df and $decode_df have fewer rows.