tidy.density {broom} | R Documentation |
Given a "density" object, returns a tidy data frame with two columns: points x where the density is estimated, points y for the estimate
## S3 method for class 'density' tidy(x, ...)
x |
an object of class "density" |
... |
extra arguments (not used) |
a data frame with "x" and "y" columns
d <- density(faithful$eruptions, bw = "sj") head(tidy(d))
library(ggplot2) ggplot(tidy(d), aes(x, y)) + geom_line()