FCE_to_TSE: Data conversion from Fixed Column Event format to TSE.

View source: R/FCE_to_TSE.R

FCE_to_TSER Documentation

Data conversion from Fixed Column Event format to TSE.

Description

Data conversion from Fixed Column Event format to TSE.

Usage

FCE_to_TSE(seqdata, id = NULL, cols, eventlist = NULL, firstEvent = NULL)

Arguments

seqdata

data frame or matrix containing event sequence data in FCE format.

id

column containing the identification numbers for the sequences.

cols

Real. Column containing the timing of the event. A missing value is interpreted as a non-occurrence of the event.

eventlist

Event names, specified in the same order as cols argument. If NULL (default), column names are used.

firstEvent

Character. The name of an event to be added at the beginning of each event sequences. This allows to include individuals with no events. If NULL (default), no event is added.

Details

The usual data format for event sequence is TSE (see seqecreate).

Value

A data.frame with three columns: "id", "timestamp" and "event".

Note

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

Author(s)

Matthias Studer

See Also

seqecreate, seqformat

Examples

## Generate a ramdom data set
fce <- data.frame(id=1:100, event1=runif(100), event2=runif(100))

## Add missing values (ie non-occurrences)
fce[runif(100)<0.1, "event1"] <- NA
fce[runif(100)<0.1, "event2"] <- NA

tse <- FCE_to_TSE(fce, id="id", cols=c("event1", "event2"),
       eventlist=c("Marriage", "Child birth"), firstEvent="Birth")

seq <- seqecreate(tse)
print(seq[1:10])


TraMineRextras documentation built on March 7, 2023, 5:54 p.m.