我有一个R数据框(df
),看起来像这样:
blogger; word; n; total
joe; dorothy; 17; 718
paul; sheriff; 10; 354
joe; gray; 9; 718
joe; toto; 9; 718
mick; robin; 9; 607
paul; robin; 9; 354
...
我想使用ggplot2
来绘制每个blogger
的n
除以total
的图表。
这是我的代码:
ggplot(df, aes(n/total, fill = blogger)) +
geom_histogram(show.legend = FALSE) +
xlim(NA, 0.0004) +
facet_wrap(~blogger, ncol = 2, scales = "free_y")
但是它会产生这个警告:
Warning message:
“Removed 1474 rows containing non-finite values (stat_bin).”Warning message in rep(no, length.out = length(ans)):
“'x' is NULL so the result will be NULL”
n/total
值都要小(或许是全部都小)。 - Andrew Gustar