Apparently there are some unnecessarily complicated tutorials out there how to draw a normal distribution (or other probability distributions) in R. No, there is no need for a loop; in fact, a single line of code is enough:

curve(dnorm(x, 0, 1), from=-4, to=4)

That’s a normal probability distribution with mean 0 and a standard deviation 1, plotted from -4 to +4.

So it’s also easy to draw normal distributions with different means or different standard deviations. Here’s one without a box around:

Thanks for checking in. Can you explain what you mean by “creating a normal distribution from data sets”? Do you want to draw a distribution with the same mean and standard deviation of the data? You could just replace the 0 and the 1 above.

Nice plot, I am wondering how do I create a normal distribution from data sets.

Thanks for checking in. Can you explain what you mean by “creating a normal distribution from data sets”? Do you want to draw a distribution with the same mean and standard deviation of the data? You could just replace the 0 and the 1 above.