我正在尝试使用 vioplot 为我想比较的两个不同组的几列生成图:
for (i in 19:length(data) ) {
# violin plot
vioplot(data[[1]][[i]], data[[2]][[i]], col="grey", names=names(data), colMed="Green")
# Calculate means
means <- tapply(data[[i]], data[["category"]], mean)
# Plot mean points.
points(means, col="red", pch=16)
# legend for median and mean in topright corner of plot.
legend('topright', c("median","mean"), pch=16, col=c("green","red"))
}
但是,我收到以下错误:
Error in cut.default(x, breaks = breaks) : 'breaks' are not unique
Calls: vioplot ... sm.density -> binning -> binning.1d -> cut -> cut.default
我认为这可能与此处描述的某些数据列的分位数相等有关: Cut() error - 'breaks' is not unique
有没有办法让 vioplot 忽略这些情况或强制情节?
谢谢!