Skip to content
Prev 260142 / 398502 Next

Box Plot under GUI (R Commander/RKward)

Hi:

I'm assuming this is a snippet of a much larger data set, because one
certainly would not use box plots on singleton observations. You have
four grouping variables in your example, so the best you could likely
do on one graphics page would be to, for example, plot time vs.
distance, 'dodged' by season, say, which would have to be distributed
over separate panels defined by combinations of transporter and
tonnage. This is certainly possible in lattice and ggplot2, with the
latter being a bit more direct for this particular problem. Here is a
reproducible example:

df <- data.frame(Season = factor(rep(c(1, 2), each = 120)),
                   Transporter = factor(rep(rep(c(1, 2), each = 60), 2)),
                   Tonnage = factor(rep(rep(c(1, 2), each = 30), 8)),
                   Distance = factor(rep(rep(c(500, 1000, 1500), each
= 10), 8)),
                   Time = rpois(240, 25))

library(ggplot2)
ggplot(df2, aes(x = Distance, y = Time, fill = Season)) +
       geom_boxplot(position = 'dodge') +
       facet_grid(Transporter ~ Tonnage)

You probably want more evocative labels for the factor variables to
make them interpretable, but that's the general idea. It is also
possible to customize the graph in several ways. To do this
interactively, you would likely need to use the Deducer package in
conjunction with rJava, as Liviu suggested. See the package web page
http://www.deducer.org/pmwiki/pmwiki.php?n=Main.DeducerManual

which shows you how to get started. The videos are very useful, too.
Its author, Ian Fellows, has kindly provided an 'all-in-one' installer
for R-2.13.0, rJava (+ its dependencies) and Deducer. I would
certainly go this route if you're not adept at installing R packages,
and would particularly recommend this service on Windows. Deducer has
a GUI like rkward and Rstudio, but it has a more user-friendly menu
system analogous to R Commander. It does, however, require Java, so
you (and your clients) need to have it installed on your systems.

HTH,
Dennis


On Tue, May 17, 2011 at 4:31 AM, Vikas Garud
<information4vikas at gmail.com> wrote: