Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

seqmpos

Number of matching positions between two sequences.


Description

Returns the number of common elements, i.e., same states appearing at the same position in the two sequences.

Usage

seqmpos(seq1, seq2, with.missing=FALSE)

Arguments

seq1

a sequence from a sequence object.

seq2

a sequence from a sequence object.

with.missing

if TRUE, gaps appearing at the same position in both sequences are also considered as common elements

.

Author(s)

Alexis Gabadinho (with Gilbert Ritschard for help page)

See Also

Examples

data(famform)
famform.seq <- seqdef(famform)

seqmpos(famform.seq[1,],famform.seq[2,])
seqmpos(famform.seq[2,],famform.seq[4,])

## Example with gaps in sequences
a <- c(NA,"A",NA,"B","C")
b <- c(NA,"C",NA,"B","C")

ex1.seq <- seqdef(rbind(a,b))

seqmpos(ex1.seq[1,], ex1.seq[2,])
seqmpos(ex1.seq[1,], ex1.seq[2,], with.missing=TRUE)

TraMineR

Trajectory Miner: a Toolbox for Exploring and Rendering Sequences

v2.2-1
GPL (>= 2)
Authors
Alexis Gabadinho [aut, cph], Matthias Studer [aut, cph] (<https://orcid.org/0000-0002-6269-1412>), Nicolas M"{u}ller [aut], Reto B"{u}rgin [aut], Pierre-Alexandre Fonta [aut], Gilbert Ritschard [aut, cre, cph] (<https://orcid.org/0000-0001-7776-0903>)
Initial release
2020-10-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.