[R] plot matrix data- lattice?

Gabor Grothendieck ggrothendieck at gmail.com
Wed Aug 1 16:01:00 CEST 2007


?matrix

On 8/1/07, Dong Guo <guo.dong99 at gmail.com> wrote:
> Thanks, Gabor.
>
> My matrix is from a big array(year, regions,variables). so, matrix does not
> have row names or col names, how could i add the col names or row names??
>
> Thanks again.
> Dong
>
>
> On 8/1/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > 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