[R] ANOVA plotting
Robert Baer
rbaer at atsu.edu
Thu Jan 20 23:34:27 CET 2011
>> I recently started using R and I have a simple question. I am running R
>> (v.
>> 2.12.1) and Rcmdr (v.1-6.3) on Mac (Snow Leopard).
>>
>> I am using a data set I used before for practicing ANOVA with R, so I
>> know
>> what the results should look like. I can get ANOVA table using both Rcmdr
>> and GUI. However, I cannot make R prepare the ANOVA diagram (with
>> boxplots,
>> showing the data points, including the outliers) for the dataset. If I
>> use
>> Rcmdr (Models>Graphs) then I get some graphical representation for the
>> ANOVA
>> model I prepared in R (showing diagnostic plots, Q-Q plots, etc.).
>> However,
>> the real ANOVA diagram is not coming up. I tried using "plot" command in
>> GUI
>> but did not get what I wanted. I could not find an answer to this on-line
>> or
>> in my book. I apologize if this was covered recently in the mailing list,
>> I
>> just became a member.
Note that it is possible to do any Rcmdr "menu operation" from the command
line simply by typing the command line output that results from doing the
menu operation in Rcmdr. Observe the red text in the output window. The
Rcmdr package supplies not only the Menu driven window, but some functions
to accomplish the operations of the Window. Observe the red text in the
output window.
Assuming you want an "interaction plot" for 2-factor ANOVA and following on
from Sarah's example paste the following code at the command line. Note
that it makes use of the Rcmdr convenience function plotMeans() so you need
the Rcmdr package loaded:
library(Rcmdr)
fakedata <- runif(100)
fakegroups <- sample(rep(letters[1:5], each=20))
factor2 = sample(rep(letters[1:2], each=50))
plotMeans(df$data, df$groups, df$factor2, error.bars="se")
For more information on how to use this function from the command line see
its help file by typing
?plotMeans
Hope you can generalize this if you were actually asking a different
question. See posting guide for best practices on providing a reproducible
example of what you want to accomplish.
Rob
More information about the R-help
mailing list