library(tidyr)
library(dplyr, warn.conflicts = FALSE)
nested_coniss <- keji_lakes_plottable %>%
group_by(location) %>%
nested_data(depth, taxon, rel_abund, fill = 0) %>%
nested_chclust_coniss()
# plot the dendrograms using base graphics
plot(nested_coniss, main = location, ncol = 1)
# plot broken stick dispersion to verify number of plausible groups
library(ggplot2)
nested_coniss %>%
select(location, broken_stick) %>%
unnest(broken_stick) %>%
tidyr::gather(type, value, broken_stick_dispersion, dispersion) %>%
ggplot(aes(x = n_groups, y = value, col = type)) +
geom_line() +
geom_point() +
facet_wrap(vars(location))
Run the code above in your browser using DataLab