epmToPhyloComm {epm} | R Documentation |
Convert epmGrid to community matrix
Description
Given specific sites, convert epmGrid to phylocomm matrix, with sites as rows, and species as columns
Usage
epmToPhyloComm(x, sites)
Arguments
x |
object of class |
sites |
locations of sites, see details. |
Details
If sites are site coordinates,
then dataframe or matrix with two columns;
if sites are cell indices, then numeric vector;
if sites = 'all'
, then all cells will be returned as sites.
Value
community matrix, with sites as rows and species as columns
Author(s)
Pascal Title
Examples
tamiasEPM
# from cell indices
cells <- c(2703, 90, 3112, 179)
epmToPhyloComm(tamiasEPM, cells)
# from coordinates
library(sf)
# get the projection of the epmGrid object
proj <- summary(tamiasEPM)$crs
# define some points
pts <- rbind.data.frame(
c(-120.5, 38.82),
c(-84.02, 42.75),
c(-117.95, 55.53))
colnames(pts) <- c('x', 'y')
ptsSF <- st_as_sf(pts, coords = 1:2, crs = "epsg:4326")
pts <- st_coordinates(st_transform(ptsSF, crs = proj))
epmToPhyloComm(tamiasEPM, pts)
[Package epm version 1.1.2 Index]