Learn R Programming

TraMineR (version 1.8-9)

seqelength: Lengths of event sequences

Description

The length of an event sequence is its time span, i.e., the total time of observation. This information is useful to perform for instance a survival analysis. The function seqelength retrieves the lengths of the provided sequences, while seqelength <- sets the length of the sequences. seqesetlength is deprecated.

Usage

seqelength(s)
seqelength(s) <- value
seqesetlength(s, len)

Arguments

s
An event sequence object (seqelist).
len
A list of sequence lengths.
value
A list of sequence lengths.

Value

  • A numeric vector with the lengths of the sequences.

Examples

Run this code
data(actcal.tse)
actcal.seqe <- seqecreate(actcal.tse)
## Since endEvent is not specified, contains no sequence lengths
## We set them manually as 12 for all sequences
sl <- numeric()
sl[1:2000] <- 12
seqelength(actcal.seqe) <- sl
actcal.seqe[1:10]
## Retrieve lengths
seqelength(actcal.seqe)

Run the code above in your browser using DataLab