Posthoc labels on anova boxplot in R

前端 未结 2 1315
半阙折子戏
半阙折子戏 2021-01-01 02:45

If I have some data and do an ANOVA and post-hoc tests, how do I make a boxplot that adds the post-hoc classification automatically, rather than having to edit the figure ou

2条回答
  •  悲哀的现实
    2021-01-01 03:43

    This would be simpler

    library(reshape)
    
    x <- rnorm(30)
    y <- rnorm(30)+1
    z <- rnorm(30)+0.5
    
    data.1 <- data.frame(x, y, z)
    data.2 <- melt(data.1)
    data.2$newgroup = factor(data.2$variable,labels=c("a","b","ab")) # only line added
    boxplot(value~newgroup, data=data.2)
    

提交回复
热议问题