R/expandSpeciesCellList.R

Defines functions expandSpeciesCellList

Documented in expandSpeciesCellList

##' Function to expand condensed species list to full set of cells

##' @title Expand species list
##'
##' @description The epmGrid object contains an accounting of species per
##' cell in a condensed format. This function returns a complete list of species
##' per cell. 
##'
##' @param x object of class \code{epmGrid}
##'
##' @return list of species for each cell.
##'
##' @author Pascal Title
##' 
##' @examples
##' tamiasEPM
##'	head(expandSpeciesCellList(tamiasEPM))
##' 
##' @export



expandSpeciesCellList <- function(x) {
	
	if (!'epmGrid' %in% class(x)) {
		stop('x must be of class epmGrid.')
	}	
	
	return(sapply(x[['cellCommInd']], function(y) x[['speciesList']][[y]]))
	
}

Try the epm package in your browser

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

epm documentation built on April 4, 2025, 1:42 a.m.