我运行了一个包含 ggplot 函数的循环,但没有产生任何对象或绘图。问题是控制台或降价中也没有出现错误标志。图例(代码):
- anova_total:包含 table_for_statistics 中所有蛋白质的 anova p 值的表
- table_for_statistics:包含我需要的所有数据的透视表(但没有方差分析结果)。
从 anova_total 中,我过滤了所有 3 个变量所需的具有特定 p 值的所有蛋白质,并获得了这些蛋白质的 ID(它们是 anova_total 中的行名),因为我不需要 anova 结果本身我必须做的情节。我只需要知道我必须绘制的蛋白质的 ID;我需要绘制的特征包含在 table_for_statistics 中。
这是我的代码:
for (k in colnames(anova_total)){
imp.prot.cat <- table_for_statistics[table_for_statistics$protein %in% sig.total$sig.total,]
print(ggplot(table_for_statistics[table_for_statistics$protein %in% imp.prot.cat,], aes(x= table_for_statistics[table_for_statistics$protein %in% imp.prot.cat, k], y= measurement))+
geom_beeswarm(aes(col= iss_group), shape=21, size=2,cex = 0.5)+
facet_wrap(~protein, scale ="free_y")+
theme(legend.position = "bottom") +
stat_compare_means(method = "t.test"))
}
您可以通过单击以下链接查看循环中的数据集: https ://i.stack.imgur.com/kwFsS.png
谢谢!