Thursday, December 16, 2010

Density plots in R

To plot the distribution of scores in R using the density function, use

plot(density(dat$scores))
To overlay scores for another variable onto the first plot, use

lines(density(dat$other_scores), col="red")
Simple enough!

No comments:

Post a Comment