我有以下数据集:
Gender option
Female Agree
Male Agree
Male Strongly Agree
Male Strongly Disagree
Male Neutral
Female Neutral
Female Neutral
Female Disagree
Female Agree
Female Strongly Disagree
Female Agree
Female Agree
Female Agree
Female Agree
Female Strongly Agree
Female Disagree
Female Agree
Female Strongly Disagree
Female Agree
Male Neutral
Male Agree
Male Neutral
Male Neutral
Male Agree
Male Disagree
Male Agree
Male Neutral
Male Strongly Agree
Male Strongly Agree
Male Neutral
我想要一个关于性别和选择的条形图 我使用了以下代码:
data <- df %>% group_by(Gender,option) %>% summarize(n=n()) %>% mutate(freq=(n)) # using dplyr
ggplot(data, aes(x=option, fill = Gender, group = Gender)) + geom_bar(aes(y=freq), stat="identity", position = "dodge")
我有条形图。但是,李克特量表的标签并不令人鼓舞。我想在X轴上从左到右获得以下列表:完全不同意,不同意,中立,同意,非常同意。我所得到的是混乱的。 我已经搜索过,但是找不到任何解决方案,如果错过了,我们感到抱歉。我们可以使用ggplot2和dplyr吗?谢谢您的帮助。