pairwise.braycurtis: Calculate the Bray-Curtis index for all possible community...

Description Usage Arguments Value Examples

View source: R/braycurtis_functions.R

Description

Given a grouped data set containing a species ID column and a column of species' ecosystem functions, this function returns a dataset of Bray-Curtis indices that results from all pairwise combinations of unique communities as defined by the grouping variable(s).

Usage

1
pairwise.braycurtis(x, species = "Species", func = "Function")

Arguments

x

A grouped data set, with grouping variables defined as in dplyr operations

species

The name of the column in x containing species ID's

func

The name of the column in x containing species' ecosystem function

Value

This function returns a data set of the Bray-Curtis indices corresponding to pairs of communities, identified by one or more grouping variables, which are provided in pairs of columns with the format: groupvar1.x groupvar1.y, etc. These can be conveniently re-combined using the group.columns() command.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
set.seed(36)

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

# Perform pairwise comparisons of all communities in cms identified by comm.id
pairwise.braycurtis(cms,species='species',func='func')

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