beanplot函数不断向我显示此错误:
Warning message:
In max(unlist(dens["y", ])) :
no non-missing arguments to max; returning -Inf
到目前为止,它一直很好。我是R的新人,我一直在努力解决问题所在,但到目前为止还没有运气。有什么建议吗?
这是我的代码:
> data$Treat <- factor(data$Treat, levels = c("Parthenogenetic", "Monoandrous", "Polyandrous"))
> beanplot(Mort~Treat, data=data, col=list("firebrick", "deepskyblue3", "chartreuse4"),
+ ylab="Number of days", xlab="Reproductive mode",
+ las=1, ylim=c(0,80), cutmin = -Inf, cutmax = Inf, log="")
答案 0 :(得分:0)
当您需要重命名labels
的类别时,请使用levels
而不是Treat
。
set.seed(1)
n <- 1000
data <- data.frame(Treat = sample(1:3, n, replace=T),
Mort = runif(n,10,70))
data$Treat <- factor(data$Treat,
labels = c("Parthenogenetic", "Monoandrous", "Polyandrous"))
library(beanplot)
beanplot(Mort~Treat, data=data, col=list("firebrick", "deepskyblue3", "chartreuse4"),
ylab="Number of days", xlab="Reproductive mode",
las=1, ylim=c(0,80), cutmin = -Inf, cutmax = Inf, log="")