set.seed(1)
df <- data.frame(x = rnorm(1e3), y = rnorm(1e3))
ggplot(df, aes(x, y)) +
geom_hdr(method = method_freqpoly()) +
geom_point(size = 1)
# The resolution of the frequency polygon estimator can be set via `bins`
ggplot(df, aes(x, y)) +
geom_hdr(method = method_freqpoly(bins = c(8, 25))) +
geom_point(size = 1)
# Can also be used with `get_hdr()` for numerical summary of HDRs
res <- get_hdr(df, method = method_freqpoly())
str(res)
Run the code above in your browser using DataLab