我想使用以下信息创建条形图。我希望它分为顶行和缺席/现在。我已经尝试了条形图和ggplot,但是他们提出了错误或不正确的信息。谢谢!
LHUM RHUM LRAD RRAD LFEM RFEM LTIB RTIB
present absent present absent present present absent present
present present absent present present present present present
present present present present present present present present
present present present present present present present present
present present present present present present present present
present present present present present present present present
present present present absent present present present present
present present absent present present present present present
present present absent present present present present present
present present present absent present present present present
present present present absent present present present present
present absent present absent present present present present
present present present absent present present present present
present present present present present absent present absent
答案 0 :(得分:1)
从你的问题来看,我并不是100%确定你想要什么。也许这个 - 假设您的数据位于名为df
首先使用tidyr
将其重塑为ggplot longform格式。然后绘制......
library(dplyr)
library(tidyr)
df <- df %>% gather(name,value,1:8)
library(ggplot2)
ggplot(df, aes(name, color=value, fill=value)) + geom_bar()