On 11/3/05, Alpert, William <[EMAIL PROTECTED]> wrote:
> I swear I've scoured the help files and several texts before posting
> what feels like a dumb newbie question.
>
> How can I draw two kernel density plots in the same frame ? I have
> similar variables in two separate data frames, and I would like to show
> their two histograms/densities in a single picture.  Same units, scale,
> range for both, so I'm simply trying to draw one and then add the other
> to the picture.  Nothin' fancy.

Using densityplot from lattice:

library(lattice)
d1 = data.frame(x = rnorm(100))
d2 = data.frame(x = rnorm(100, mean = 0.5))
densityplot(~d1$x + d2$x, plot.points = FALSE)

-Deepayan

______________________________________________
R-help@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

Reply via email to