Learn R Programming

TraMineRextras (version 0.6.8)

rowmode: Modal state of a variable

Description

Returns the modal state of a variable, e.g., the modal state in a sequence.

Usage

rowmode(v, except = NULL)

Value

The modal value

Author

Gilbert Ritschard

Arguments

v

A numerical or factor variable.

except

Vector of values that should be ignored; e.g., set except="*" to ignore missing states with default coding.

Details

The function tabulates the variable and returns the most frequent value.

See Also

Examples

Run this code
data(actcal)
actcal.seq <- seqdef(actcal[1:10,13:24])
actcal.mod <- apply(as.matrix(actcal.seq), 1, rowmode)
head(actcal.mod)

Run the code above in your browser using DataLab