Skip to contents

This function extracts a row-wise subset of a classification or regression result object.

Usage

sub_result(x, indices)

Arguments

x

The input result object, which should be an instance of a classification or regression result class.

indices

A vector of row indices to extract from the result object.

Value

A new result object containing only the specified row indices from the input result object.

Examples

# Create a simple classification result object
observed <- c(1, 0, 1, 1, 0)
predicted <- c(1, 0, 0, 1, 1)
result <- list(observed = observed, predicted = predicted)
class(result) <- c("classification_result", "list")

# Extract a subset of the result object
sub_result(result, c(2, 3, 4))
#> Error in UseMethod("sub_result"): no applicable method for 'sub_result' applied to an object of class "c('classification_result', 'list')"