[R] Multiple density plots
hadley wickham
h.wickham at gmail.com
Mon Mar 10 22:12:51 CET 2008
On Mon, Mar 10, 2008 at 3:55 PM, Sean MacEachern <sean.maceach at gmail.com> wrote:
> Hi all,
>
> I'm interested in doing a multiple density plot on a number of columns in a
> dataframe.
>
> >DF
>
> lineA.1 lineA.2 lineB.1 lineB.2
> r1 5.355354 6.665575 10.288498 11.74750
> r2 3.643415 5.427600 11.407112 13.97065
> r3 5.813674 6.438502 9.628871 11.57456
> r4 5.241340 5.125049 10.456221 12.35381
> r5 4.640885 8.635518 8.344704 11.98484
> r6 4.559852 6.416171 10.419599 10.89247
> r7 4.058033 7.378469 9.043280 11.88214
> r8 3.439271 5.108395 10.197870 10.65987
> r9 5.129664 4.326907 8.851552 11.46618
> r10 4.258742 7.002541 8.716967 13.07019
>
>
>
> I have been reading about the simple.densityplot
>
> However, I can't find it in R has it been replaced?
>
>
>
> >simple.densityplot(line6.1,line6.2,line7.1,line7.2, data = DF)
> Error: could not find function "simple.densityplot"
You could also try:
install.packages("ggplot2")
library(ggplot2)
qplot(value, data = melt(DF), colour=variable, geom="density")
which will give you a nice legend as well.
--
http://had.co.nz/
More information about the R-help
mailing list