Skip to content
Back to formatted view

Raw Message

Message-ID: <4DAC57FF.5050405@ucalgary.ca>
Date: 2011-04-18T15:25:51Z
From: Peter Ehlers
Subject: side by side histogram after splitting data by year
In-Reply-To: <BANLkTim6h+iehjzHDidgGs9ZfKXmGeCrrA@mail.gmail.com>

On 2011-04-17 16:29, jim holtman wrote:
> Will one of these do it for you:
>
>> str(x)
> 'data.frame':   550 obs. of  5 variables:
>   $ year    : Factor w/ 2 levels "one","two": 1 1 1 1 1 1 1 1 1 1 ...
>   $ size    : Factor w/ 2 levels "large","small": 2 2 2 2 2 2 2 2 2 2 ...
>   $ distance: num  30.9 121.5 46.1 46.1 46.1 ...
>   $ taken   : int  10 2 12 1 4 1 10 3 5 5 ...
>   $ mass    : num  13.88 2.78 16.65 1.39 5.55 ...
>> require(lattice)
>> histogram(~taken|year, x)
>> histogram(~taken|year*size, x)
>>

Jeff,

I would use lattice (or ggplot2) as well. But you
may want to look at the histbackback() function in
pkg Hmisc.

Peter Ehlers

[...snip...]

>
>
> On Sun, Apr 17, 2011 at 10:51 AM, Stratford, Jeffrey
> <jeffrey.stratford at wilkes.edu>  wrote:
>> Hi everyone,
>>
>>
>>
>> I'm looking to produce a side-by-side histogram of the number of trips
>> taken by jays with a particular number of acorns after accounting for
>> year (year "one" and year "two"). I know this involves indexing first
>> then creating a histogram but I'm not sure how I'd do this. I want to
>> explore the possibilities that jays are altering their strategies in
>> different years.  Data are below.
>>
>>
>>
>> This is a common need for myself so any help would be greatly
>> appreciated!
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Jeff
>>

[...snip...]

> --
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.