[R] Grouped Histogram (colored)

x0rr0x till.salzgeber at gmail.com
Thu Oct 16 18:42:06 CEST 2008


Hi all,

I'm trying to create a histogram which shows the frequency of variables
within a certain timeframe.

I've been using SPSS before, but I didn't quite like it...

To describe my problem further here are some example variables:

the "event" is actually a string which I recoded using:
[code]
data$event_class = as.numeric(as.factor(data$event))
[/code]
I've recoded them into numerics


csv:
[code]
time,event,event_class
01,cookies,1
05,cookies,1
06,pie,2
07,coffee,3
08,cookies,1
30,pie,2
31,coffee,3
[/code]
and so on...

Now I'd like to create a histogram where X is the time, the color of the
area is the event_class
and Y is defined by the frequency of event_class around some accumulated
time



In SPSS I used this:
Graphs -> Chart Builder
Gallery->Histogram
use some horizontal histogram
put "time" on the x-axis
select "grouping/stacking variables" in the "groups/point id" tab
and then set "Stack: set-color" to event_class
the y-axis will be automatically set to "histogram"

thanks a lot in advance!

Regards,
- x0rr0x
-- 
View this message in context: http://www.nabble.com/Grouped-Histogram-%28colored%29-tp20015941p20015941.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list