1

To perform an ANOVA in R I normally follow two steps:

1) I compute the anova summary with the function aov 2) I reorganise the data aggregating subject and condition to visualise the plot

I wonder whether is always neccesary this reorganisation of the data to see the results, or whether it exists a f(x) to plot rapidly the results.

Thanks for your suggestions

G.

Guillon
  • 5
  • 1
  • 6
  • 1
    It would help if you provided a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data. What exactly are you plotting? – MrFlick May 18 '17 at 13:32

1 Answers1

3

I think what you mean is to illustrate the result of your test with a figure ? Anova are usually illustrate with boxplot.

set.seed(1234)
data <- data.frame(group = c(rep("group_1",25),rep("group_2",25)), scores = c(runif(25,0,1),runif(25,1.5,2.5)))


mod1<-aov(scores~group,data=data)
summary(mod1)

You can make boxplot with the implemented function plot or boxplot

boxplot(scores~group,data=data)
plot(scores~group,data=data)

Or with ggplot

require(ggplot2)
require(ggsignif)

ggplot(data, aes(x = group, y = scores)) +
  geom_boxplot(fill = "grey80", colour = "blue") +
  scale_x_discrete() + xlab("Group") +
  ylab("Scores") +
  geom_signif(comparisons = list(c("group_1", "group_2")), 
          map_signif_level=TRUE)

Hope this helps

Nico Coallier
  • 676
  • 1
  • 8
  • 22