norm2likert: Convert normal to likert

Description Usage Arguments Value Examples

View source: R/distribution_convertors.R

Description

Convert normal to likert

Usage

1
norm2likert(x, prob, mu = mean(x), sd = stats::sd(x))

Arguments

x

the normally distributed vector

prob

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

mu

the mean of x (calculated from x if not given)

sd

the SD of x (calculated from x if not given)

Value

a vector with the specified distribution

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x <- rnorm(10000)
y <- norm2likert(x, c(.1, .2, .35, .2, .1, .05))
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")

y <- norm2likert(x, c(40, 30, 20, 10))
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")

y <- norm2likert(x, c(lower = .5, upper = .5))
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")

faux documentation built on Sept. 14, 2021, 1:08 a.m.