STS_to_SPELL: Data conversion from STS to SPELL format.

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Convert data from STS to vertical SPELL format.

Usage

1
STS_to_SPELL(seqdata, id=NULL, pdata=NULL, birthdate=NULL, with.missing=TRUE)

Arguments

seqdata

a state sequence object of type "stslist" (see seqdef).

id

Either a vector of sequence id's or name of the id column in pdata. If NULL, rownames(seqdata) are used.

pdata

Data frame with id and birth dates.

birthdate

Either a vector of sequence birth dates or name of the birth date column in pdata.

with.missing

Logical. Should explicit spells of missing states be included?

Details

SPELL format is a vertical format with one row per spell, each spell being specified with four variables: an id, a begin date, a end date, and the state.

Value

A data.frame with the sequences in vertical SPELL format.

Note

This function is a pre-release and further testing is still needed, please report any problems.

Author(s)

Matthias Studer

See Also

See Also seqformat.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(biofam)
biofam <- biofam[1:20,]

## Create the sequence object
bfstates <- c("Parent", "Left", "Married", "Left/Married", "Child",
            "Left/Child", "Left/Married/Child", "Divorced")
bf.shortlab <- c("P","L","M","LM","C","LC", "LMC", "D")
bf.seq <- seqdef(biofam[,10:25], alphabet=0:7, states=bf.shortlab, labels=bfstates)

spell <- STS_to_SPELL(bf.seq, birthdate=biofam$birthyr)
head(spell)

TraMineRextras documentation built on April 15, 2017, 10:55 a.m.

Search within the TraMineRextras package
Search all R packages, documentation and source code