R/dataStat.R

dataStat <- function(sppVector, genVector, thresh = 5){
unSpp <- unique(sppVector)
unGen <- unique(genVector)
sppnum <- sapply(unSpp, function(x) length(which(sppVector %in% x)))
tab <- table(NULL)
tab[1:7] <- c(length(unGen), length(unSpp), min(sppnum), max(sppnum), median(sppnum), mean(sppnum), length(which(sppnum < thresh)))
names(tab) <- c("Genera", "Species", "Min", "Max", "Median", "Mean", "Thresh" )
round(tab, digits=0)
}

Try the spider package in your browser

Any scripts or data that you put into this service are public.

spider documentation built on May 2, 2019, 5:16 p.m.