On Tue, Nov 23, 2010 at 2:49 PM, Art Burke
<art.bu...@educationnorthwest.org> wrote:
> Given the data structure below, how can I create a bar plot for the values of 
> disc for each area grouped by year?
>
> bar <-structure(list(year = c(2003, 2003, 2003, 2003, 2003, 2003, 2003,
> 2007, 2007, 2007, 2007, 2007, 2007, 2007), area = structure(c(6L,
> 4L, 1L, 2L, 3L, 5L, 7L, 6L, 4L, 1L, 2L, 3L, 5L, 7L), .Label = c("AK",
> "ID", "MT", "NW", "OR", "US", "WA"), class = "factor"), disc = c(55.8,
> 62.6, 54.3, 56.9, 52.8, 66.7, 64.8, 59.5, 64.8, 65.8, 61.4, 60.6,
> 66.3, 65.5)), .Names = c("year", "area", "disc"), class = "data.frame", 
> row.names = c(NA,
> 14L))
>

Try this:

library(lattice)
barchart(disc ~ year | area, horiz = FALSE,  transform(bar, year =
factor(year)))

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
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.

Reply via email to