set.seed(1234)
levels <- c("lowest", "low", "neutral", "high", "highest")
# a bimodal distribution: high dissention
x <- ordered(
sample(levels, 4000, replace = TRUE, prob = c(0.45, 0.04, 0.02, 0.04, 0.45)),
levels = levels
)
dissent(x)
# a unimodal distribution: low dissention
y <- ordered(
sample(levels, 4000, replace = TRUE, prob = c(0.95, 0.02, 0.015, 0.01, 0.005)),
levels = levels
)
dissent(y)
# both together, as an rvar
xy <- c(rvar(x), rvar(y))
xy
dissent(xy)
Run the code above in your browser using DataLab