abMat: Generate a species by site abundance matrix

View source: R/abMat.R

abMatR Documentation

Generate a species by site abundance matrix

Description

Generate a species by site abundance matrix

Usage

abMat(x, site_id, species_id, fpc = NULL, abundance = NULL)

Arguments

x

dataframe of individual records

site_id

column name string of site IDs

species_id

column name string of species names

fpc

optional column name string of sampling weights of each record, between 0 and 1

abundance

optional column name string with an alternative abundance measure such as biomass, canopy cover, body length

Value

dataframe of species abundances (columns) per site (rows)

Examples

x <- data.frame(site_id = rep(c("A", "B", "C"), each = 3), 
  species_id = sample(c("a", "b", "c", "d"), 9, replace = TRUE), 
  fpc = rep(c(0.5, 0.6, 1), each = 3), 
  abundance = seq(1:9))
abMat(x, "site_id", "species_id")
abMat(x, "site_id", "species_id", "fpc")
abMat(x, "site_id", "species_id", "fpc", "abundance")


johngodlee/JLGMisc documentation built on June 29, 2024, 9:15 p.m.