FCE_to_TSE {TraMineRextras} | R 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 |
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 |
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
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])