Extract p-value from aov
I know this is old but I looked around online and didn't find an explanation or general solution and this thread is one of the first things that comes up in a Google search.
Aniko is right, the easiest way is looking in summary(test)
.
tests <- summary(test)str(tests)
That gives you a list of 1 for an independent measures aov object but it could have multiple items with repeated measures. With the repeated measures each item in the list is defined by the error term for the item in the list. Where a lot of new people get confused is that if it's between measures the one lone list item isn't named. So, they don't really notice that and don't understand why using a typical selector doesn't work.
In the independent measures case something like the following works.
tests[[1]]$'Pr(>F)'
In repeated measures it's similar but you could also use named items like...
myModelSummary$'Error: subject:A'[[1]]$'Pr(>F)'
Note there I still had to do that list selection because each one of the list items in the repeated measures model is again a list of 1.