Skip to contents

Execute a Processing Recipe

Usage

hs_process(cube, recipe = hs_recipe(), learn = TRUE)

Arguments

cube

An hsi_cube object.

recipe

A recipe from hs_recipe().

learn

Logical. Allow fitting an unspecified MSC reference on this cube. Set FALSE for validation or prediction data.

Value

List containing the processed cube and reusable fitted recipe.

Examples

recipe <- hs_recipe(list(list(method = "snv"), list(method = "msc")))
fitted <- hs_process(hs_example_cube(), recipe)
# Reuse the MSC reference learned above on held-out data
new_cube <- hs_simulate_cube(rows = 10, cols = 10, seed = 7)
held_out <- hs_process(new_cube, fitted$recipe, learn = FALSE)
dim(held_out$cube)
#> [1] 10 10 61