A list with the following elements:
NstatesInteger. Number of possible states for the trait, based on the unique values encountered in raw_states
(after conversion to characters). This may be larger than the number of unique values in raw_states
, if fill_gaps
was set to TRUE
.
state_namesCharacter vector of size Nstates, storing the original name (character version) of each state. For example, if raw_states
was c("b1","3","a12","a2","b1","a2")
and sort_order=="natural"
, then Nstates
will be 4 and state_names
will be c("3","a2","a12","b1")
.
state_valuesOptional, only included if include_state_values==TRUE
. A numeric vector of size Nstates
, providing the numerical value for each unique state.
mapped_statesInteger vector of size equal to length(raw_states)
, listing the integer representation of each value in raw_states
.
name2indexAn integer vector of size Nstates, with names(name2index)
set to state_names
. This vector can be used to map any new list of states (in character format) to their integer representation. In particular, name2index[as.character(raw_states)]
is equal to mapped_states
.