Quantcast

Multiple density plots

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multiple density plots

sean.maceach
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"

> sessionInfo()
R version 2.6.0 (2007-10-03)
i386-apple-darwin8.10.1

locale:
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] MASS_7.2-41

loaded via a namespace (and not attached):
[1] tools_2.6.0



Sorry if this is a simple question, but I haven't found much reference to
any changes on the web or in any tutorials.

Cheers,

Sean

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple density plots

Erik Iverson
Where were you "reading about" that function?

simple.densityplot seems to be from a user-supplied package called "UsingR".

Try

install.packages("UsingR")
library("UsingR")

and then try your simple.densityplot function call.

Best,
Erik Iverson

Sean MacEachern 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"
>
>> sessionInfo()
> R version 2.6.0 (2007-10-03)
> i386-apple-darwin8.10.1
>
> locale:
> en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] MASS_7.2-41
>
> loaded via a namespace (and not attached):
> [1] tools_2.6.0
>
>
>
> Sorry if this is a simple question, but I haven't found much reference to
> any changes on the web or in any tutorials.
>
> Cheers,
>
> Sean
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple density plots

hadley wickham
In reply to this post by sean.maceach
On Mon, Mar 10, 2008 at 3:55 PM, Sean MacEachern <[hidden email]> 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/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...