R/SampleDepth.R

Defines functions sampleDepth

sampleDepth <- function(rwl, stc = c(5, 2, 1)) {
  temp <- rbind(colnames(rwl), rwl)
  NoTREES <- function(rw) {
    rw[!is.na(rw)] <- substr(rw[1], 1, stc[1] + stc[2])
    return(rw)
  }
  temp <- apply(temp, 2, NoTREES)
  temp <- temp[-1, ]
  NoCores <- apply(rwl, 1, function(y) {
    sum(!is.na(y))
  })
  NoTrees <- apply(temp, 1, function(y) {
    length(unique(y[!is.na(y)]))
  })
  out <- data.frame(NoTrees, NoCores)
  return(out)
}

Try the detrendeR package in your browser

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

detrendeR documentation built on April 16, 2022, 1:06 a.m.