Modal state of a variable

Share:

Description

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

Usage

1
rowmode(v, except = NULL)

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.

Value

The modal value

Author(s)

Gilbert Ritschard

See Also

table.

Examples

1
2
3
4
data(actcal)
actcal.seq <- seqdef(actcal[1:10,13:24])
actcal.mod <- apply(as.matrix(actcal.seq), 1, rowmode)
head(actcal.mod)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.