[R] (Novice-) Problem with the plot-function

Douglas Bates bates at stat.wisc.edu
Fri Feb 6 18:03:45 CET 2004


Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> writes:

> I think you meant to do
> 
> plot(x, f.x, ...)
> 
> BTW, you've re-invented the wheel. See ?dnorm for evaluating the normal pdf.
> 
> Best,
> Sundar

Even easier is to combine dnorm and curve (although Luke will grimace
at the syntax).

curve(dnorm(x, mean = 0, sd = 1), from = -5, to = 5)

This form allows you to change the mean and the standard deviation.
If you want to pretty it up a bit use

curve(dnorm(x, mean = 0, sd = 1), from = -5, to = 5, las = 1)




More information about the R-help mailing list