May 2019
Beginner to intermediate
266 pages
5h 57m
English
The first type of plot that will be created based on the density or probability function is named dnorm(). dnorm() will specify the density or the probability for the normal distribution curve. The normal distribution curve, created with the dnorm() function and attribute to be used, for example, PetalWidthCm, can be executed with the following command:
> p1 <- ggplot(data = Iris, aes(PetalWidthCm)) ++ stat_function(fun = dnorm, n = 101, args = list(mean = 0, sd = 1)) + ylab("") ++ scale_y_continuous(breaks = NULL)> p1
We get the following plot from this:

Read now
Unlock full access