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 March 7, 2023, 5:54 p.m.