[R] Plotting multiple age distributions with histogram()

Juliane Struve juliane_struve at yahoo.co.uk
Thu Aug 4 15:47:36 CEST 2011


Dear list,
 
I would like to plot several age distributions that are influenced by a factor (called group in the data example below). I would like to use historam() in the lattice package, but I can't figure out how to set up the data. Could someone give me a hint how to do it  for the example below? 
 
Thanks a lot,
 
Juliane 
 
data <- structure(list(Age = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L), No = c(1084609L, 
1076523L, 1066171L, 887874L, 881239L, 872763L, 726800L, 720632L, 
712984L), Group = c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L)), .Names = c("Age", 
"No", "Group"), class = "data.frame", row.names = c(NA, -9L))




More information about the R-help mailing list