alphabet(seqdata)
alphabet(seqdata) <- value
seqdef
function.alphabet
function, i.e. one label for each state in the alphabet.alphabet
' a character vector containing the alphabet.For 'alphabet <-
' the updated sequence object.
seqdef
function --- stores sequences as a matrix where columns are factors. The levels of the factors are made of the alphabet as well as the codes for missing value and void elements. The alphabet function retrieves or sets the "alphabet" attribute of the sequence object.
The state names composing the alphabet are preferably short labels, since they are used for printing sequences. Longer labels for describing more precisely each state in legend are stored in the "labels" attribute of the sequence object.seqdef
## Creating a sequence object with the columns 13 to 24
## in the 'actcal' example data set
data(actcal)
actcal.seq <- seqdef(actcal,13:24)
## Retrieving the alphabet
alphabet(actcal.seq)
## Setting the alphabet
alphabet(actcal.seq) <- c("FT", "PT", "LT", "NO")
Run the code above in your browser using DataLab