price.part.column: Wrapper function for applying Price partition to list of...

Description Usage Arguments Value Examples

View source: R/Price_FUNCTIONS.R

Description

Given a list of species names and their ecosystem functions, this function generates a reference community, and then compares the reference community against a set of other communities (including species and their ecosystem function) supplied in a separate, grouped data frame. This is a low-level function that invokes price.part.single() and is called by higher-level functions such as pairwise.price(), which automates the pairwise comparison of many communities.

Usage

1
price.part.column(sps, func, dat)

Arguments

sps

A vector of species' names for the reference community

func

A numerical vector of species' ecosystem functions in the reference community

dat

A grouped data frame of species' names and ecosystem functions, which must contain at least one grouping variable, as created by dplyr's function group_by(). Additionally, the species and function columns must be named 'species' and 'func', respectively.

Value

This function returns a data set of Price equation components, one full set for each community (uniquely identified by the grouping variable(s) of dat) compared against the reference community

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(36)
cm1<-data.frame(sps=LETTERS[seq(1,6)],func=rpois(6,lambda = 2))

# Data frame containing multiple communities we want to compare with cm1
cms<-data.frame(comm.id=sort(rep(seq(1,3),6)),
                species=rep(LETTERS[seq(1,6)],3),
                func=rpois(6*3,lambda = 2))
cms<-group_by(cms,comm.id)

# Compare species/functions of cm1 to all communities in cms, individually
price.part.column(sps=cm1$sps,func=cm1$func,dat=cms)

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