library(purrr)
library(SIBER)
# ---- create community names data frame ----
# uncomment to use
# str(demo.siber.data.2)
demo.siber.data.2$group_name <- as.factor(demo.siber.data.2$group)
demo.siber.data.2$group <- as.numeric(demo.siber.data.2$group_name) |>
as.character()
demo.siber.data.2$community_name <- as.factor(demo.siber.data.2$community)
demo.siber.data.2$community <- as.numeric(demo.siber.data.2$community_name) |>
as.character()
cg_name <- demo.siber.data.2 |>
dplyr::distinct(community, group, community_name, group_name)
# ---- create comparsions ----
cg_names_within_c <- create_comparisons(cg_name,
comparison = "within")
demo.siber.data.2 <- demo.siber.data.2[,1:4]
siber_example <- createSiberObject(demo.siber.data.2)
ml_within_overlap <- cg_names_within_c |>
map(~ maxLikOverlap(.x$cg_1, .x$cg_2, siber_example,
p.interval = NULL, n = 100), .progress = TRUE)
ml_95_within_com <- extract_similarities(ml_within_overlap, type = "ml",
community_df = cg_name)
Run the code above in your browser using DataLab