dlikert: Likert density function

View source: R/distribution_convertors.R

dlikertR Documentation

Likert density function

Description

Likert density function

Usage

dlikert(x, prob, labels = names(prob))

Arguments

x

the likert distributed vector

prob

a vector of probabilities or counts; if named, the output is a factor

labels

a vector of values, defaults to names(prob) or 1:length(prob), if numeric, the output is numeric

Value

a vector of the densities

Examples

x <- 1:5
prob <- c(.1, .2, .4, .2, .1)
dlikert(x, prob)

x <- c("A", "C", "B", "B")
prob <- c(A = 10, B = 20, C = 30)
dlikert(x, prob)

# specify labels if prob not named and not 1:length(prob)
labels <- -2:2 
x <- sample(labels, 10, replace = TRUE)
prob <- rep(1, length(labels)) # uniform probability
dlikert(x, prob, labels)

faux documentation built on April 20, 2023, 9:13 a.m.