Re: [R] plotting groups via density and different colors

2011-07-20 Thread Carlos Ortega
Hi, Instead of hist you can use functions histogram() or densityplot() in lattice package: require(lattice) histogram( ~ length | factor(sex), data=dene ) densityplot( ~ length, data=dene, groups=factor(sex), auto.key = list(space = "b

[R] plotting groups via density and different colors

2011-07-18 Thread Jacob Kasper
I have a data set that looks like this: dene <- data.frame(length = c(35,32,33,34,41,40,46,35,41,40,45,36,38,37,39,40,42,42,42,43,44), sex=c(1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,2,2,2,2,2,2)) I would like to plot the density (frequency of occurrence) of each length class but I want to have different colo