Re: [R] side by side histogram after splitting data by year

From: Peter Ehlers <ehlers_at_ucalgary.ca>
Date: Mon, 18 Apr 2011 08:25:51 -0700

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.



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. Received on Mon 18 Apr 2011 - 15:29:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Apr 2011 - 16:00:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive