【发布时间】:2022-01-07 12:10:48
【问题描述】:
我正在尝试绘制以下李克特项目:
structure(list(`Likelihood of attending more frequently` = structure(c(4L,
4L, 4L, 3L, 4L, 4L, 3L, 4L, 5L, 4L, 4L, 4L, 4L, 5L, 3L, 5L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 4L, 5L, 4L, 3L, 2L, 3L,
3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 5L, 4L, 4L, 4L, 3L,
4L, 5L, 3L, 3L, 2L, 4L, 4L, 3L, 4L, 1L, 3L, 3L, 4L, 5L, 4L, 4L,
4L, 4L, 4L, 3L, 4L, 4L, 5L, 4L, 2L, 5L, 3L, 2L, 3L, 3L, 5L, 4L,
4L, 2L, 3L, 2L, 4L, 5L, 3L, 4L, 4L, 4L, 4L, 5L, 4L, 4L, 3L, 4L,
4L, 4L, 5L, 3L, 3L, 4L, 3L, 4L, 3L, 3L, 5L, 5L, 4L, 4L, 5L, 2L,
1L, 4L, 4L, 4L, 1L, 4L, 3L, 2L, 4L, 4L, 4L, 4L, 5L, 4L, 5L, 4L,
5L, 4L, 2L, 5L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 3L,
3L, 4L, 4L, 4L, 5L, 5L, 4L, 5L, 5L, 3L, 2L, 4L, 5L, 5L, 1L, 5L,
2L, 1L, 5L, 4L, 1L, 4L, 5L, 4L, 2L, 4L, 4L, 4L, 5L, 3L, 2L, 5L,
5L, 5L, 4L), .Label = c("Highly unlikely", "Somewhat unlikely",
"Neither likely nor unlikely", "Somewhat likely", "Highly likely"
), class = "factor"), Reason = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("Class times conflict with my schedule",
"I am not interested in the content offered", "I don't have time",
"I don't have transportation", "I don't know where to find information on classes, programs, and events",
"Other", "There are not classes near me"), class = "factor")), row.names = c(NA,
-180L), class = "data.frame")
当我检查组项目的因子水平时,它显示 7 ,但是,likert.bar.plot 有 9 个组,因为 2 个重复。
like<-likert(freq[, c(1), drop=FALSE], grouping = freq$Reason)
likert.bar.plot(like,wrap.grouping = 40)
我检查了文本字符串是否不同,但它们完全相同。 知道是什么原因造成的吗?
【问题讨论】:
-
不幸的是,您提供的示例数据无法重现您的问题。但是,从您发布的图像来看,您的重复组实际上是不同的,即看起来好像某些 obs 的标签。包括换行符。因此,这些组被视为不同的类别。
-
如果有帮助,我可以包含整个数据集,但是当我使用 wrap.grouping 时会创建中断
-
@stefan 我已经包含了整个 df。出于某种奇怪的原因,wrap.grouping 仅适用于非重复组。
-
嗯。奇怪的。这对我来说似乎是一个错误。我仔细查看了绘图代码。据我所知,问题在于,对于条形,使用了未包装的组标签,而对于百分比标签,则使用了包装的标签。因此,我们最终得到了重复的组。
-
有意思,我会在github上发布问题。看起来@jbryer 在响应错误方面做得很好。感谢您帮助确定问题,即使我们无法解决。
标签: ggplot2 axis-labels likert