Hello friends, can anyone help me answering this question? I don't really know how to respond.
Question: Plot can be used to make regular old scatter plots. Why doesn't plot make a scatter plot when passed the object anovaOutput?
#runs an anova on my data and saves the out put
anovaOutput <- aov(Temp ~ Month, data = airquality)
#I plot the output of the anova
par(mfrow = c(2,2)) #this is just used to show the four graphs create by the next line.
plot(anovaOutput)
ADD COMMENT
• link
updated 7 months ago by
Ram
44k
•
written 3.8 years ago by
Rob
▴
170
2
Entering edit mode
plot() can detect certain classes of objects and then 'know' which components to use to generate the plot. In this case, plot() may not have a default behaviour for objects produced by aov()
Actually, the default behavior of the plot() function applied to an object of the aov or lm class is to plot diagnostic plots to check the quality of the annova. This happen because different plot methods are applied depending on the class. To know the class of your object, use class(anovaOutput). Then methods(plot) will list all the different methods available for the plot function. It is also possible to define your own methods for your newly defined classes. Also, to see what a method does, you can use the function getAnywhere():
Thanks Carlo
So, what I understood from your answer is: according to the class of my object (here aov object) a different method (different from default) is applied for plotting with the plot ().
plot()
can detect certain classes of objects and then 'know' which components to use to generate the plot. In this case, plot() may not have a default behaviour for objects produced byaov()
If you want a scatter plot, would this not make better sense?
...or, indeed, just:
Thanks Kevin, You are right. This is just an assignment question for R course that I do not know how to explain in words.
This post does not seem to have anything to do with bioinformatics and might be closed as off-topic.