[R] Understanding lattice barchart() display
Peter Ehlers
ehlers at ucalgary.ca
Wed Oct 24 08:47:05 CEST 2012
On 2012-10-23 15:39, Rich Shepard wrote:
> On Tue, 23 Oct 2012, Bert Gunter wrote:
>
>> I believe you are misunderstanding what a barchart is (or maybe I do,
>> since I never use 'em). I believe that there should be one quant value for
>> each tclass and stream, and you have several.
>
> Bert,
>
> My first attempt at using barchart()
>
>> ?panel.barchart
>> is the place to look for documentation for details of any lattice
>> display. Note especially the "horizontal" argument details (also in
>> ?barchart).
>
> I looked at the panel section in ?barchart but did not gain any insights
> into why there are segments in the bars.
As Bert correctly points out, you have more than one quant value per
tclass/stream combination. You need to summarize your 1987-case
data.frame to a 56-case data.frame (8 levels of tclass and 7 levels
of stream). The easy way to do that is:
benthos2 <- aggregate(quant ~ tclass + stream, data = benthos,
FUN = sum)
Then just use benthos2 as the data argument to barchart().
Peter Ehlers
More information about the R-help
mailing list