On Tue, Aug 25, 2009 at 10:16 AM, w_poet<stephen...@ucla.edu> wrote: > > Hi R community, > > I'm just starting out in R and have a basic question about xyplot and > tables. Suppose I had a table of data with the following names: Height, > Age_group, City. I'd like to plot mean Height vs Age_group for each City. > > When I try to do the following: > >> library(lattice) >> xyplot(mean(Height) ~ Age_group | City) > > of course I get just one data point, the mean Height for all individuals.
One additional pointer: panel.average will do this for you: xyplot(Height ~ Age_group | City, panel = panel.average) or xyplot(Height ~ Age_group | City, type = "a") As others have pointed out, this is not usually a good idea, but with a 'groups' argument, this is a cheap way to get an interaction plot. -Deepayan ______________________________________________ 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.