data.setup: Data setup for Price Equation calculations.

Description Usage Arguments Value Examples

View source: R/Price_FUNCTIONS.R

Description

Take two separate community lists and create a single data set, which is ready for calculating the Price Equation partitions.

Usage

1
data.setup(input, aggregate = "sum")

Arguments

input

Data on the composition of a pair of communities. This can take on two different forms: (i) a single data frame, where the first column is 'species', a list of taxa names, and the following two columns list the function of each species in communities X and Y. Species absent from one community are given an entry of 0 function. (ii) a list of two separate data frames, one for each community X and Y, each containing two columns, and the corresponding function of each species.

aggregate

A rule for aggregating multiple entries for the same species. The default option is "sum", a secondary option is "mean"

Value

A data frame of species identities and functions, appropriately formatted for running price partition calculations.

species

A list of species names

func.X

The function of each species in communityX

func.Y

The function of each species in community Y

wvec

An indicator variable equal to 1 when a species occurs in both X and Y

xvec

An indicator variable equal to 1 when a species occurs in X

yvec

An indicator variable equal to 1 when a species occurs in Y

Examples

1
2
3
4
5
6
7
8
# Method 1:
data.setup(list(biomass))

# Method 2:
comX <- biomass[biomass$biomassX!=0,c('species','biomassX')]
comY <- biomass[biomass$biomassY!=0,c('species','biomassY')]

data.setup(list(comX,comY))

ctkremer/priceTools documentation built on May 28, 2019, 7:49 p.m.