我正在尝试添加变量名称(即 x、y 和 z)作为每个箱线图的标题:
bpdf = data.frame(group=c("A","A","A","B","B","B","C","C","C"),
x=c(1,1,2,2,3,3,3,4,4),
y=c(7,5,2,9,7,6,3,1,2),
z=c(4,5,2,9,8,9,7,6,7))
par(mfrow=c(1,3))
lapply(bpdf[-1],function(x){
y <- sort(tapply(x,bpdf$group,median),decreasing=TRUE)
boxplot(x~factor(bpdf$group,levels=names(y)),
main=paste(colnames(bpdf[-1])))
})
我在main
通话中遗漏了一些东西(向 agstudy 寻求以前的帮助)。