R/InfreqSpeciesGroupInprove.R

InfreqSpeciesGroup <- function(data, k){
  data <- data[-1]
  data <- as.numeric(data)
  Q <- function(i, data){length(data[which(data == i)])}

  x <- data[which(data != 0)]
  r <- c(1:k)
  Rare.Species.Group <- matrix(sapply(r, function(r)Q(r, x)), 1, k)
  rownames(Rare.Species.Group) <- c("    Incidence freq. counts")
  colnames(Rare.Species.Group) <- paste("Q", r, sep="")
  return(Rare.Species.Group)
}

Try the SpadeR package in your browser

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

SpadeR documentation built on May 2, 2019, 3:59 p.m.