Given a "density" object, returns a tidy data frame with two
columns: points x where the density is estimated, points y
for the estimate
Usage
"tidy"(x, ...)
Arguments
x
an object of class "density"
...
extra arguments (not used)
Value
a data frame with "x" and "y" columnsd <- density(faithful$eruptions, bw = "sj")
head(tidy(d))library(ggplot2)
ggplot(tidy(d), aes(x, y)) + geom_line()