Lm for sample similarity and geographical distance
geo_sim(otutab, geo, method = "bray", spe_nwk = NULL, ...)
an otutab data.frame, samples are columns, taxs are rows.
a two-columns dataframe, first is latitude, second is longitude
Dissimilarity index, partial match to "bray", "euclidean"...see vegdist;unifrac
a phylo tree if use unifrac...
additional
a ggplot
Graco-Roza, C. et al. (2022) Distance decay 2.0 - A global synthesis of taxonomic and functional turnover in ecological communities. Glob Ecol Biogeogr 31, 1399–1421.
if (requireNamespace("NST") && requireNamespace("geosphere")) {
library(ggplot2)
data(otutab, package = "pcutils")
metadata[, c("lat", "long")] -> geo
geo_sim(otutab, geo) -> geo_res
pcutils::my_lm(geo_res[4], "dis.geo", geo_res)
}
#> Loading required namespace: NST