R/ObsNumberPerSpecies.R

Defines functions ObsNumberPerSpecies

Documented in ObsNumberPerSpecies

#' Calculate observation number per species.
#'
#' @param data A FData object.
#'
#' @return return a vector with observation number per species.
#' @export
#'

ObsNumberPerSpecies <- function(data){
  vSpeciesName <- unlist(lapply(levels(data$species),function(i) {
    length(utils::unstack(data,number~species)[[i]])})
  )
  names(vSpeciesName) <- levels(data$species)
  return(vSpeciesName)
}
thomasdenis973/FormatDataToGDS documentation built on May 24, 2019, 2:03 a.m.