Description Usage Arguments Examples
Simple function to plot diversity profiles.
1 | simple_plot(res)
|
res |
object of class |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ## Not run:
# Define metacommunity
pop1 <- data.frame(a = c(1,3), b = c(1,1))
row.names(pop1) <- paste0("sp", 1:2)
pop1 <- pop1/sum(pop1)
meta1 <- metacommunity(pop1)
qs <- 0:2
# Plot subcommunity beta diversity
b <- raw_beta(meta1)
sc <- subdiv(b, qs)
plot(sc)
# Plot metacommunity beta diversity
mc <- metadiv(b, qs)
plot(mc)
# Plot subcommunity and metacommunity beta diversity
res <- diversity(list(sc, mc))
plot(res)
# Plot all subcommunity diversity measures
all_sc <- subdiv(meta1, qs)
plot(all_sc)
# Plot all metacommunity diversity measures
all_mc <- metadiv(meta1, qs)
plot(all_mc)
# Plot all diversity measures
all_res <- diversity(list(all_sc, all_mc))
plot(all_res)
# Try a single population
pop2 <- c(1,3,4)
pop2 <- pop2/sum(pop2)
meta2 <- metacommunity(pop2)
sc <- sub_gamma(meta2, qs)
plot(sc)
mc <- meta_gamma(meta2, qs)
plot(mc)
# Try large number of subcommunities
pop3 <- matrix(sample(1000), ncol = 100)
row.names(pop3) <- paste0("sp", 1:10)
pop3 <- pop3/sum(pop3)
meta3 <- metacommunity(pop3)
sc <- sub_gamma(meta3, qs)
plot(sc)
# Plot naive with similarity
# Create Lookup table
Species <- c("tenuifolium", "asterolepis", "simplex var.grandiflora", "simplex var.ochnacea")
Genus <- c("Protium", "Quararibea", "Swartzia", "Swartzia")
Family <- c("Burseraceae", "Bombacaceae", "Fabaceae", "Fabaceae")
Subclass <- c("Sapindales", "Malvales", "Fabales", "Fabales")
lookup <- cbind.data.frame(Species, Genus, Family, Subclass)
# Assign values for each level (Shimatani's taxonomic distance)
taxDistance <- c(Species = 0, Genus = 1, Family = 2, Subclass = 3, Other = 4)
distance <- tax2dist(lookup, taxDistance)
similarity <- dist2sim(distance, "linear")
pop <- data.frame(a = c(1,3,6,3), b = c(1,1,2,8))
row.names(pop) <- lookup$Species
pop <- pop/sum(pop)
alpha <- norm_meta_alpha(metacommunity(pop), 0:2)
alphaZ <- norm_meta_alpha(metacommunity(pop, similarity), 0:2)
alphaZ$partition_level <- paste0(alphaZ$measure, "_Z")
plot_this <- diversity(list(alpha, alphaZ))
plot(plot_this)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.