library(poppr)
data(Pinf)
diversity_ci(Pinf, n = 100L)
if (FALSE) {
# With pretty results
diversity_ci(Pinf, n = 100L, raw = FALSE)
# This can be done in a parallel fasion (OSX uses "multicore", Windows uses "snow")
system.time(diversity_ci(Pinf, 10000L, parallel = "multicore", ncpus = 4L))
system.time(diversity_ci(Pinf, 10000L))
# We often get many requests for a clonal fraction statistic. As this is
# simply the number of observed MLGs over the number of samples, we
# recommended that people calculate it themselves. With this function, you
# can add it in:
CF <- function(x){
x <- drop(as.matrix(x))
if (length(dim(x)) > 1){
res <- rowSums(x > 0)/rowSums(x)
} else {
res <- sum(x > 0)/sum(x)
}
return(res)
}
# Show pretty results
diversity_ci(Pinf, 1000L, CF = CF, center = TRUE, raw = FALSE)
diversity_ci(Pinf, 1000L, CF = CF, rarefy = TRUE, raw = FALSE)
}
Run the code above in your browser using DataLab