[R] table, xyplot, names, & loops

w_poet
Tue, 25 Aug 2009 17:16:51 -0000

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.

I also tried constructing a new array with mean Height for each Age_group,
factored by City, but couldn't find any way of doing this without using
loops.

I'm sure there must be an elegant way of plotting this in R without
resorting to loops, but I can't find any hints in the online manuals.

Thanks for any tips~


--
View this message in context:
http://www.nabble.com/table%2C-xyplot%2C-names%2C---loops-tp25138552p25138552.html
Sent from the R help mailing list archive at Nabble.com.