[R] what "density" is plotting ?

Ralf B ralf.bierig at gmail.com
Fri Jun 25 04:43:23 CEST 2010


Hi Carrie,

the output is defined by you; density() only creates the function
which you need to plot using the plot() function. When you call
plot(density(x)) you get the output on the screen. You need to use
pdf() if you want to create a pdf file, png() for creating a png file
or postscript if you like ps; there are many others.

Ralf

On Thu, Jun 24, 2010 at 10:35 PM, Carrie Li <carrieandstat at gmail.com> wrote:
> Hi everyone,
>
> I am confused regarding the function "density".
> suppose that there is a sample x of 100 data points, and plot(density(x))
> gives it's pdf ?
> or it's more like histogram only ?
>
> thanks for any answering
>
> Carrie
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>



More information about the R-help mailing list