
> From: Abhijit Dasgupta <adasgupta@araastat.com>
> Date: October 31, 2010 1:30:02 AM EDT
> To: Matt Shotwell <shotwelm@musc.edu>
> Subject: Re: [R] ForestPlot or similar
> 
> I just did something very similar using ggplot's pointrange geom. In the following, I'm plotting hazard ratios, for which the nominal value is 1 and not 0. x has 5 columns: drug, hr, hr.lcb, hr.ucb, and group, and I'm faceting by group.  If you want the plots horizontal, add coord_flip() to the command --- as it stands the plots are vertically oriented. 
> 
>        require(ggplot2)
>        p <- ggplot(x, aes(x=drug, y = hr, ymin=hr.lcb, ymax=hr.ucb))+
>                geom_pointrange()+ facet_grid(.~group)
>        p <- p + xlab('Drug') + ylab('Hazard ratio')+
>                geom_hline(y=1, col='red', lty=2)
> 
> 
> Abhijit
> On Oct 30, 2010, at 5:31 PM, Matt Shotwell wrote:
> 
>> Here is a small function for forest plots in R, with an example:
>> 
>> http://biostatmatt.com/wiki/r-credplot
>> 
>> -Matt
>> 
>> On Sat, 2010-10-30 at 11:40 -0400, Mestat wrote:
>>> Here is one example:
>>> I have three vectors (mean,lower interval, upper interval)
>>> mean<-c(2,4,6,8)
>>> l<-c(1,2,3,4)
>>> u<-c(4,8,12,16)
>>> How would I plot that if I want to use the FORESTPLOT function. I dont need
>>> to use the TABLETEXT option.
>>> I am working in something like this:
>>> tabletext<-c(NA,NA,NA,NA,NA)
>>> mean<-c(NA,2,4,6,8)
>>> l<-c(NA,1,2,3,4)
>>> u<-c(NA,4,8,12,16)
>>> forestplot(tabletext,mean,l,u,zero=0)
>>> But I am having a problem with the length of the dimension...
>>> Thanks in advance,
>>> Marcio
>>> 
>> 
>> -- 
>> Matthew S. Shotwell
>> Graduate Student 
>> Division of Biostatistics and Epidemiology
>> Medical University of South Carolina
>> 
>> ______________________________________________
>> R-help@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.
> 


	[[alternative HTML version deleted]]

