1
我使用Likert R软件包生成图表。我有以下的最小R实施例:R Likert软件包 - 更改标签级别
library("likert")
group = c("One", "Two", "One", "Two", "One")
response = c(1, 2, 3, 3, 4)
df = data.frame(response)
levels = c("Strongly Disagree", "Disagree", "Neither Agree nor Disagree", "Agree", "Strongly Agree")
df$response = recode(df$response, from=c(1, 2, 3, 4, 5), to=levels)
df$response = as.factor(df$response)
df$response = factor(df$response, levels=levels)
likert_data = likert(df, grouping=group)
plot(likert_data, legend.position="right", plot.percents=FALSE, plot.percent.low=FALSE, plot.percent.high=FALSE, plot.percent.neutral=FALSE, group.order=c("One", "Two"))
+ ggtitle("Title Here")
+ theme(axis.text.y = element_text(colour="black", size="10", hjust=0))
+ theme(axis.text.x = element_text(colour="black", size="10"))
这产生的曲线图,但是,在右侧的“响应”的标签,这仅列出的5个李克特选项4。它缺少“非常赞同”,因为它不是数据点。
我该如何强制它列出标签中的所有Likert数据级别?(编辑:已解决,查看评论)- 如何将左侧的组标签更改为我指定的名称?
我最终找到包中的违规部分并强制它通过“limits”参数显示。我在这里提出了一个拉取请求,但是,我认为它可能是一个传递参数,是否要删除标签。 https://github.com/jbryer/likert/pull/25 – firefly2442