View source: R/HSPELL_to_STS.R
HSPELL_to_STS | R Documentation |
Convert data from Horizontal Spell to STS.
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)
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 |
fillblanks |
If not |
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. |
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
.
A data.frame
with the sequence in STS format.
This function is a pre-release and further testing is still needed, please report any problems.
Matthias Studer
See Also seqformat
.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.