[R] Fw: [S] plot stacked bar chart in R

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Tue Dec 16 23:29:55 CET 2003


Did you look at ?barplot?

# x is a data.frame from below
x2 <- do.call("rbind", split(x$Count, x$CAT1))
dimnames(x2)[[2]] <- letters[1:3]

barplot(x2, legend = TRUE)


Sundar

Yun-Fang Juan wrote:

> posting the question in r-help@ to get more feedback :-)
> 
> thanks,
> 
> Yun-Fang
> ----- Original Message ----- 
> From: "Yun-Fang Juan" <yunfang at yahoo-inc.com>
> To: <s-news at wubios.wustl.edu>
> Sent: Tuesday, December 16, 2003 2:04 PM
> Subject: [S] plot stacked bar chart in R
> 
> 
> 
>>Hi,
>>I am trying to plot a stacked bar chart in R but am not able to find the
>>documentation.
>>
>>The input data format is like the following
>>
>>
>>CAT1 CAT2 Count
>>A a  234
>>A b  758
>>A c  156
>>B a  753
>>B b  568
>>B c  684
>>C a  356
>>C b  564
>>C c  256
>>D a  123
>>D b 165
>>D c  754
>>
>>please advice.
>>
>>
>>thanks,
>>
>>
>>Yun-Fang
>>
>>
>>--------------------------------------------------------------------
>>This message was distributed by s-news at lists.biostat.wustl.edu.  To
>>...(s-news.. clipped)...
> 
> 
>>
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list