Extract state durations from a sequence object.
Extracts states durations from a sequence object. Returns a matrix containing the states durations for the sequences. The states durations in 'D-D-D-D-A-A-A-A-A-A-A-D'
are 4,7,1. Distinct states can be extracted with the seqdss
function.
seqdur(seqdata, with.missing=FALSE)
seqdata |
a sequence object as defined by the |
with.missing |
Should non-void missing values be considered as regular states? See Details. |
When with.missing=FALSE
(default) missing values are ignored and a substring AA***A
for example will be considered as a spell AAA
of duration 3. When with.missing=TRUE
, durations are also computed for spells of missing values (gaps in sequences).
See seqdef on options for handling missing values when creating sequence objects.
a matrix containing the states durations for each distinct state in each sequence.
Alexis Gabadinho and Gilbert Ritschard
## Creating a sequence object from columns 13 to 24 ## in the 'actcal' example data set ## Here we retain the first 10 sequences only. data(actcal) actcal.seq <- seqdef(actcal[1:10,13:24]) ## Retrieving the spell durations actcal.dur <- seqdur(actcal.seq) ## Displaying the durations for the first 10 sequences actcal.dur
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.