[R] plot matrix data- lattice?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Aug 1 15:43:05 CEST 2007


Try this:

mat <- matrix(1:24, 6, dimnames = list(year = 2001:2006, region = letters[1:4]))

library(lattice)
xyplot(Freq ~ year | region, as.data.frame.table(mat))




On 8/1/07, Dong Guo <guo.dong99 at gmail.com> wrote:
> Dear all,
>
> I have a matrix, dim = (years, regions)
>
> I would like to plot the data in a lattice so that  each panel is region's
> plot with y-axis based on values, x-axis based on year.
>
> how can I do that?
>
> Many thanks in advance.
>
> Dong
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list