[R] categorized barplot

John Kane jrkrideau at yahoo.ca
Thu Aug 20 20:51:14 CEST 2009


I think you want a barplot.  I don't see what a histogram will add.  

Your attachement seems to have been lost so I am just guessing what you might want but, assuming you have a data.frame try

barplot(as.matrix(xx[,2:3]), beside = TRUE)

dd <- t(as.matrix(xx[,2:3]))
colnames(dd) <- xx[,1]
barplot(dd, beside=TRUE)

Have a look at arguments such as density and color in ?barplot for lines etc. 


--- On Thu, 8/20/09, Rafael Moral <rafa_moral2004 at yahoo.com.br> wrote:

> From: Rafael Moral <rafa_moral2004 at yahoo.com.br>
> Subject: [R] categorized barplot
> To: "r-help" <r-help at r-project.org>
> Received: Thursday, August 20, 2009, 2:29 PM
> Dear useRs,
> 
> I can't seem to find out how to categorize my histogram.
> 
> I have the following dataset:
> 
> Time            First.day  Second.day
> 08:00-10:00        9             8
> 10:00-12:00       13           15
> 12:00-14:00        9             9
> 14:00-16:00       10            9
> 
> I attached a jpeg file to this e-mail containing the
> sketches.
> What I'd like to do is a barplot (or histogram),
> firstly with 2 categories - first and second day (figure
> 1)
> And then with 4 categories - the times (figure 2)
> Also, I'd like the graphs both with lines (as sketched) and
> bars.
> 
> Thanks in advance,
> Kind regards,
> 
> Rafael.
> 
> 
>      
> ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
> -----Inline Attachment Follows-----
> 
> ______________________________________________
> 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.
> 


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/




More information about the R-help mailing list