R/rowmode.R

Defines functions rowmode

Documented in rowmode

## returns the modal value of a variable
## author: Gilbert Ritschard

rowmode <- function(v, except = NULL) {
	tt <- table(v)
	tt <- tt[!(names(tt) %in% except)]
	return(names(tt)[which.max(tt)])
}

Try the TraMineRextras package in your browser

Any scripts or data that you put into this service are public.

TraMineRextras documentation built on Aug. 19, 2024, 3:02 p.m.