
Make a class lookup table
make_class_lookup.RdProduces a distinct class lookup table from point data. If no usable class ID column exists, IDs are assigned in sorted class order starting at 0.
Examples
cpc <- system.file("extdata", "HIW_158_W_U-1.cpc", package = "pointcoral")
xwalk <- system.file(
"extdata", "pointcoral_example_crosswalk.csv",
package = "pointcoral"
)
pts <- standardize_labels(read_cpce_file(cpc), read_label_crosswalk(xwalk))
make_class_lookup(pts, class_col = "ml_class")
#> # A tibble: 6 × 2
#> label class_id
#> <chr> <int>
#> 1 CORAL (C) 0
#> 2 SPONGES (S) 2
#> 3 MACROALGAE (MA) 4
#> 4 PEYSSONNELIACEAE 5
#> 5 CORALLINE ALGAE (CA) 7
#> 6 SAND, PAVEMENT, RUBBLE (SPR) 8