data(glomel)
# Extract compositional data matrix
glomel_comp <- as.matrix(glomel[,!(names(glomel) %in% c("ID", "Ref", "Complementary"))])
rownames(glomel_comp) <- glomel$ID
# Calculate Bray-Curtis distance matrix
glomel_bc <- vegan::vegdist(glomel_comp, method = "bray")
# Define reference envelope (5 stations) by observation ID
glomel_env <- glomel$ID[glomel$Ref]
# Assess quality with respect to reference envelope
compareToStateEnvelope(glomel_bc, glomel_env)
Run the code above in your browser using DataLab