Pre-Summarized Data

10 views
Skip to first unread message

Ed

unread,
Sep 1, 2009, 1:42:21 PM9/1/09
to ggplot2
Hey,

unfortunately I did not deal with ggplot2 for a while and now a friend
of mine wants to create a diagramm with pre-summarized data and I have
no clue how to handle it.

The Data Frame which I aggregated now looks like this :

Year Group Amount
2001 G1 43245
2002 G1 312321
2001 G2 432432
2002 G2 343243
2001 G3 3423
2002 G3 32

And I want to put the years in different facets, where the amount of
every group is displayed.

Unfortunately I have no clue how to deal with presummarized data in
ggplot2 :-(

Can anyone give an advice ?

Thank you very much and best regards,

Ed

Luciano Selzer

unread,
Sep 1, 2009, 2:17:33 PM9/1/09
to ggplot2
Hi Ed, 

just add stat='identity', so the code looks like this:

qplot(Group, Amount, data=your_dataframe, geom='bar', stat='identity')+facet_wrap(~Year)

I hope it works for you.
Bye




--
Luciano

Ed

unread,
Sep 2, 2009, 10:47:29 AM9/2/09
to ggplot2
Hell yeah that worked. With ggplot(..) it did not. Perhaps I specified
something wrong.

Anyway thank you very much :-)

Best regards,

Ed

On 1 Sep., 20:17, Luciano Selzer <luciano.sel...@gmail.com> wrote:
> Hi Ed,
> just add stat='identity', so the code looks like this:
>
> qplot(Group, Amount, data=your_dataframe, geom='bar',
> stat='identity')+facet_wrap(~Year)
>
> I hope it works for you.
> Bye
>
> 2009/9/1 Ed <edven...@googlemail.com>
Reply all
Reply to author
Forward
0 new messages