R/HeightofXtallesttrees.R

Defines functions height.of.X.tallest.trees

Documented in height.of.X.tallest.trees

height.of.X.tallest.trees <- function(height, uplotID, num.trees){

  ## order by uplotID all heights
  mean.height <- aggregate(height ~ uplotID, FUN = function(x){
    x <- x[order(x, decreasing = TRUE)]
    mean(x[1:(min(c(length(x), num.trees)))])
  }
  )
  
  return(mean.height)
}

Try the sitreeE package in your browser

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

sitreeE documentation built on Nov. 24, 2021, 1:13 a.m.