#источник - https://t.me/rstudioprogr
library(likert)
## Загрузка требуемого пакета: ggplot2
## Загрузка требуемого пакета: xtable
library(viridis)
## Загрузка требуемого пакета: viridisLite
scale <- c("1 Strongly disagree", "2 Disagree", "3 Agree", "4 Strongly agree")
set.seed(143)
V1 <- as.factor(sample(scale, 50, replace = TRUE))
V2 <- as.factor(sample(scale, 50, replace = TRUE))
V3 <- as.factor(sample(scale, 50, replace = TRUE))
V4 <- as.factor(sample(scale, 50, replace = TRUE))
data1 <- data.frame(V1, V2, V3, V4)
summary(likert(data1))
## Item low neutral high mean sd
## 1 V1 48 0 52 2.48 1.1109841
## 2 V2 48 0 52 2.52 0.9946797
## 3 V3 52 0 48 2.36 1.1021315
## 4 V4 58 0 42 2.18 1.0631106
plot(likert(data1)) + scale_fill_viridis_d()
##
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.

plot(likert(data1), positive.order=FALSE) + scale_fill_viridis_d() + theme_classic() + theme(legend.position = "bottom")
##
## Scale for fill is already present.
## Adding another scale for fill, which will replace the existing scale.

plot(likert(data1), type="heat", low.color = "white", high.color = "slateblue", text.color = "black", text.size = 4, wrap = 50)

plot(likert(data1),type="density", facet = TRUE, bw = 0.5) + scale_color_brewer(palette = "Spectral")
