我正在尝试使用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' are not unique
有没有办法让vioplot忽略这些情况或强迫情节呢?
谢谢!