Learn R Programming

TraMineR (version 2.2-10)

seqdecomp: Convert a character string into a vector of states or events

Description

States can be represented by any substring that does not include the sep value. An empty separator sep = "" can only be used when each state is coded with a single character.

Usage

seqdecomp(data, var=NULL, sep='-', miss="NA", vnames=NULL)

Arguments

data

a dataframe, matrix, or character string vector containing sequence data (tibble will be converted with as.data.frame).

var

the list of columns containing the sequences. Default is NULL, ie all the columns. Whether the sequences are in the compressed (character strings) or extended format is automatically detected by counting the number of columns.

sep

the between states/events separator used in the input data set. Default is '-'.

miss

the symbol for missing values (if any) used in the input data set. Default is NA.

vnames

optional names for the column/variables of the output data set. Default is NULL.

See Also

seqconc.

Examples

Run this code
# 1 sequence of length 4
seqdecomp("A-BB-C-DD")

# 2 sequences of length 6
seqdecomp(c("ABBCDD","BBCCAD"),sep="")

Run the code above in your browser using DataLab