- data
Data frame, matrix, stslist
state sequence object, or character string vector.
The data to use. (Tibble will be converted with as.data.frame
).
A data frame or a matrix with sequence data in one or more columns when
from = "STS"
or from = "SPS"
. If sequence data are in a single
column or in a string vector, they are assumed to be in the compressed form (see stsep
).
A data frame with sequence data in one or more columns when from = "SPELL"
.
If sequence data has not four columns ordered as individual ID, spell
start time, spell end time, and spell state status, use var
or
id
/ begin
/ end
/ status
.
A state sequence object when from = "STS"
or from
is not specified.
- var
NULL
, List of Integers or Strings.
Default: NULL
.
The indexes or the names of the columns with the sequence data in data
.
If NULL
, all columns are considered.
- from
String.
The format of the input sequence data.
It can be "STS"
, "SPS"
, or "SPELL"
. It is not needed
if data
is a state sequence object.
- to
String.
The format of the output data.
It can be "STS"
, "DSS"
, "SPS"
, "SRS"
, "SPELL"
, or "TSE"
.
- compress
Logical.
Default: FALSE
.
When to = "STS"
, to = "DSS"
, or to = "SPS"
, should the
sequences (row vector of states) be concatenated into strings? See
seqconc
.
- nrep
Integer.
The number of shifted replications when to = "SRS"
.
- tevent
Matrix.
The transition-definition matrix when to = "TSE"
.
It should be of size \(d * d\) where \(d\) is the number of distinct
states appearing in the sequences. The cell \((i,j)\) lists the events
associated with a transition from state \(i\) to state \(j\). It can be
created with seqetm
.
- stsep
NULL
, Character.
Default: NULL
.
The separator between states in the compressed form (strings) when
from = "STS"
or from = "SPS"
.
If NULL
, seqfcheck
is called for detecting automatically
a separator among "-" and ":". Other separators must be specified explicitly.
See seqdecomp
.
- covar
List of Integers or Strings.
The indexes or the names of additional columns in data
to include as
covariates in the output when to = "SRS"
.
The covariates are replicated across the shifted replicated rows.
- SPS.in
List.
Default: list(xfix = "()", sdsep = ",")
.
The specifications for the state-duration couples in the input data when
from = "SPS"
.
The first specification, xfix
, specifies the prefix/suffix character.
Use a two-character string if the prefix and the suffix differ. Use
xfix = ""
when no prefix/suffix are present. The second
specification, sdsep
, specifies the state/duration separator.
- SPS.out
List.
Default: list(xfix = "()", sdsep = ",")
.
The specifications for the state-duration couples in the output data when
to = "SPS"
.
See SPS.in
above.
- id
NULL
, Integer, String, List of Integers or Strings.
Default: 1
.
When from = "SPELL"
, the index or the name of the column containing
the individual IDs in data
(after var
filtering).
When to = "TSE"
, the index or the name of the column containing
the individual IDs in data
(after var
filtering) or the unique
individual IDs. If id
is not manually specified, id
is set as
NULL
for backward compatibility with TraMineR 1.8-13 behaviour. If
id
is manually or automatically set as NULL
, the original
individual IDs are ignored and replaced by the indexes of the sequences in the
input data.
When from = "SPELL"
and to = "TSE"
, the index or the name of
the column containing the individual IDs in data
(after var
filtering). The TSE output will use the original individual IDs.
- begin
Integer or String.
Default: 2
.
The index or the name of the column containing the spell start times in
data
(after var
filtering) when from = "SPELL"
.
Start times should be positive integers.
- end
Integer or String.
Default: 3
.
The index or the name of the column containing the spell end times in
data
(after var
filtering) when from = "SPELL"
.
End times should be positive integers.
- status
Integer or String.
Default: 4
.
The index or the name of the column containing the spell statuses in
data
(after var
filtering) when from = "SPELL"
.
- process
Logical.
Default: TRUE
.
When from = "SPELL"
, if TRUE
, create sequences on a process
time axis, if FALSE
, create sequences on a calendar time axis.
This process
argument as well as the associated pdata
and pvar
arguments are intended for data
containing spell data with calendar begin
and end times. When those times are ages, use process = FALSE
with
pdata=NULL
to use those ages as process times. Option process = TRUE
does currently not work for age times.
- pdata
NULL
, "auto"
, or data frame.
Default: NULL
. (tibble will be converted with as.data.frame
).
If NULL
, the start and end times of each spell are supposed to be, if
process = TRUE
, ages, if process = FALSE
, years when
from = "SPELL"
.
If "auto"
, ages are computed using the start time of the first spell
of each individual as her/his birthdate when from = "SPELL"
and
process = TRUE
. For from = "SPELL"
and process = FALSE
, "auto"
is equivalent to NULL
.
A data frame containing the ID and the birth time of the individuals when
from = "SPELL"
or to = "SPELL"
. Use pvar
to specify
the column names. The ID is used to match the birth time of each individual
with the sequence data. The birth time should be integer. It is the start
time from which the positions on the time axis are computed. It also serves
to compute tmin
and to guess tmax
when the latter are NULL
,
from = "SPELL"
, and process = FALSE
.
- pvar
List of Integers or Strings.
The indexes or names of the columns of the data frame pdata
that
contain the ID and the birth time of the individuals in that order.
- limit
Integer.
Default: 100
.
The maximum age of age sequences when from = "SPELL"
and process = TRUE
.
Age sequences will be considered to start at 1 and to end at limit
.
- overwrite
Logical.
Default: TRUE
.
When from = "SPELL"
, if TRUE
, the most recent episode
overwrites the older one when they overlap each other, if FALSE
,
in case of overlap, the most recent episode starts after the end of the
previous one.
- fillblanks
Character.
The value to fill gaps between episodes when from = "SPELL"
.
- tmin
NULL
or Integer.
Default: NULL
.
The start time of the axis when from = "SPELL"
and process = FALSE
.
If NULL
, the value is the minimum of the spell start times
(see begin
) or the minimum of the birth time of the individuals
(see pdata
when it is a data frame and process = FALSE
).
- tmax
NULL
or Integer.
Default: NULL
.
The end time of the axis when from = "SPELL"
and process = FALSE
.
If NULL
, the value is the maximum of the spell end times (see end
)
or the sum of the maximum of the spell end times and of the maximum of the
birth time of the individuals (see pdata
when it is a data frame and
process = FALSE
).
- missing
String.
Default: "*"
.
The code for missing states in data
.
It will be replaced by NA
in the output data. Ignored when data
is a state sequence object
(see seqdef
), in which case the attribute nr
is used as missing value code.
- with.missing
Logical.
Default: TRUE
.
When to = "SPELL"
, should the spells of missing states be included?
- right
One of "DEL"
or NA
.
Default: "DEL"
.
When to = "SPELL"
and with.missing=TRUE
, set right=NA
to include the end spells of missing states.
- compressed
Deprecated. Use compress
instead.
- nr
Deprecated. Use missing
instead.