# median of numeric vector
typical(rpois(100, lambda = 10))
# most frequent value of character or factor
x <- sample(c("a", "b", "c"), 100, prob = c(0.6, 0.2, 0.2), replace = TRUE)
typical(x)
typical(factor(x))
# if tied, returns them all
x <- c("a", "a", "b", "b", "c")
typical(x)
# median of an ordered factor
typical(ordered(c("a", "a", "b", "c", "d")))
Run the code above in your browser using DataLab