[R] Odp: Barplots

Petr PIKAL petr.pikal at precheza.cz
Tue Jul 13 13:27:17 CEST 2010


Hi

r-help-bounces at r-project.org napsal dne 13.07.2010 12:18:21:

> Hi R,
> 
> 
> 
> I am examining the mean returns 10 days before and 10 days after a
> event. Now I have several events the corresponding pre and post event 10
> day mean returns... something like this
> 
> 
> 
> Pre_Start              Pre_End              Pre_Mean            Pre_SD
> Post_Start            Post_End            Post_Mean
> Post_SD
> 
> 1              2002-02-22          2002-03-08          0.004968027
> 0.017443954       2002-03-12          2002-03-25          0.0004099697
> 0.012529438
> 
> 2              2002-04-25          2002-05-08          -0.006371706
> 0.011008257      2002-05-10          2002-05-23          -0.0022429404
> 0.007736497
> 
> 3              2002-07-24          2002-08-06          0.005083225
> 0.015508255       2002-08-08          2002-08-21          0.0048237816
> 0.008116529
> 
> 4              2002-07-24          2002-08-06          0.005083225
> 0.015508255       2002-08-08          2002-08-21         0.0048237816
> 0.008116529
> 
> 5              2003-01-08          2003-01-21         0.004439480
> 0.012310963       2003-01-23          2003-02-05         -0.0064620002
> 0.012731789
> 
> 
> 
> I obtained a barplot using the below
> 
> layout(matrix(c(1,1,2,2),ncol=2,byrow=T))
> 
> barplot(rnorm(10),main="Pre_Event_Returns",col="red")
> 
> barplot(rnorm(10),main="Post_Event_Returns",col="blue")

Maybe

barplot(rbind(rnorm(10), 
rnorm(10)),main="Event_Returns",col=c("red","blue"), beside=T)

+ appropriate legend

Regards
Petr


> 
> 
> 
> However I would like to know if it is possible to do the following-
> merge the two barplots i.e. a single barplot which will include both the
> pre and post event returns 
> 
> Any suggestions would be appreciated
> 
> Ravi
> 
> This e-mail may contain confidential and/or privileged 
i...{{dropped:13}}
> 
> ______________________________________________
> 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.



More information about the R-help mailing list