Pairs each simulated species code with its group, and builds the one-row-per-group table that LandR::vegTypeMapGenerator() takes as sppEquiv for cohorts recoded to their groups (recode_cohorts()).

sppEquiv_groups(sppEquiv, sppEquivCol, groupCol)

Arguments

sppEquiv

data.table species equivalency table with columns sppEquivCol, groupCol and Type. It is not modified.

sppEquivCol

character; the column of simulated species codes.

groupCol

character; the column of groups.

Value

A list: map, a named character vector from simulated code to group; groups, a data.table with one row per group (sorted) and columns groupCol and Type; and col, groupCol.

Details

It is an error for a simulated code to have no group, or more than one, and for a group to hold both conifers and broadleaves (Type). LandR::vegTypeMapGenerator() reads Type, one row per code, to find mixedwood stands (mixedType = 2), so a group of both would be counted twice there.