Skip to content
Back to formatted view

Raw Message

Message-ID: <f8e6ff050902211352l60393cfetfb90df1a1752362d@mail.gmail.com>
Date: 2009-02-21T21:52:36Z
From: Hadley Wickham
Subject: Grouped bwplots?
In-Reply-To: <376e97ec0902201257k74383fcdy58a40571098046ef@mail.gmail.com>

On Fri, Feb 20, 2009 at 3:57 PM, Fredrik Karlsson <dargosch at gmail.com> wrote:
> Dear list,
>
> I am sorry for asking you this, but I am trying to do again what I
> thought I have done before, although this time it does not work.
>
> So, given the data set:
>
>> testdf <- data.frame(grfak=sample(c("One","Two"),size=100,replace=TRUE), panfak= sample(c("Yes","No"),size=100,replace=TRUE), xfak= sample(c("Yep","Nope"),size=100,replace=TRUE),  d=rnorm(100))
>
> I would like to do:
>
>> bwplot(d ~ xfak | panfak,data=testdf, groups= grfak)
>
> where the groups argument makes a difference (as in dividing each box
> into two by group).
> Is this possible to do? If so, what I am doing wrong?

An alternative approach is to use ggplot2:

install.packages("ggplot2")
library(ggplot2)
qplot(xfak, d, data=testdf, facets = ~panfak, fill = grfak, geom="boxplot")

Hadley
-- 
http://had.co.nz/