R/CAP.R

Defines functions CAP

Documented in CAP

CAP<-function(x, transform=NULL, verbose=FALSE) {
  cap<-function(x, verbose=FALSE) {
    if(verbose) cat(".")
    y = as.matrix(x)
    if(ncol(y)>1) {
      for(i in (ncol(y)-1):1) {
        y[,i] = y[,i]+y[,i+1]
      }
    }
    dimnames(y) <- dimnames(x)
    return(y)
  }
  if(!inherits(x,"stratifiedvegdata")) stop("Input should be of class 'stratifiedvegdata'")
  Y = lapply(x, FUN=cap, verbose=verbose)
  if(!is.null(transform)) Y = lapply(Y, FUN=transform)
  names(Y)<-names(x)
  class(Y)<-c("CAP","list")
  return(Y)
}

Try the vegclust package in your browser

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

vegclust documentation built on Aug. 25, 2022, 9:08 a.m.