Learn R Programming

TraMineRextras (version 0.2.2)

HSPELL_to_STS: Data conversion from Horizontal Spell to STS.

Description

Convert data from Horizontal Spell to STS.

Usage

HSPELL_to_STS(seqdata, begin, end, status = NULL,
    fixed.status = NULL, pvar = NULL, overwrite = TRUE,
    fillblanks = NULL, tmin = NULL, tmax = NULL, id = NULL,
    endObs = NULL)

Arguments

seqdata
a data frame or matrix containing sequence data.
begin
Vector containing the columns (name or number) with the beginning position of each spell.
end
Vector containing the columns (name or number) with the end position of each spell.
status
Vector containing the columns (name or number) with the status of each spell.
fixed.status
Default status (for period not covered by any spell.)
pvar
names or numbers of the column containing the 'birth' time.
overwrite
Should the most recent episode overwrite the older one when they overlap? If FALSE, the most recent episode starts from the end of the previous one.
fillblanks
If not NULL, character used for filling gaps between episodes.
tmin
If sequences are to be defined on a calendar time axis, it defines the starting time of the axis. If set as NULL, the start time is set as the minimum of the 'begin' column in the data.
tmax
If year sequences are wanted, defines the ending year of the sequences. If set to NULL, it is guessed from the data (not so accurately!).
id
column containing the identification numbers for the sequences.
endObs
An optional end of observation date. Usefull for retrospective survey.

Value

  • A data.frame with the sequence in STS format.

Details

Hortizontal spell data format has the following caracteristics: - One row per individual - Each spell is specified with three consecutive variables: a begin date, an end date, and the status. - For unused spells, begin and end values should be set as NA.

See Also

See Also seqformat.

Examples

Run this code
hspell <- data.frame(begin1=rep(1, 5), end1=c(2:5, NA), status1=1:5,
                     begin2=c(3:6, NA), end2=rep(NA, 5), status2=5:1)
sts <- HSPELL_to_STS(hspell, begin=c("begin1", "begin2"), end=c("end1", "end2"),
                     status=c("status1", "status2"))

Run the code above in your browser using DataLab