[R] Matrix barplot

Andreas Tille tillea at rki.de
Fri Jul 25 15:12:32 CEST 2008


On Fri, 25 Jul 2008, Nutter, Benjamin wrote:

>> data <- data.frame(Year=c(2000,2001,2002),
>                     A=c(4,2,1),
>                     B=c(3,1,2),
>                     C=c(0,3,5))
>
>> data.mat <- as.matrix(data)[,2:4]
>> rownames(data.mat) <- data$Year
>> data.mat <- t(data.mat)
>> barplot(data.mat,beside=TRUE)

Thanks a lot

          Andreas.

-- 
http://fam-tille.de



More information about the R-help mailing list