Description Usage Arguments Value Examples
View source: R/jaccard_functions.R
Given a grouped data set containing a species ID column and a column of species' ecosystem functions, this function returns a dataset of Jaccard indices that results from all pairwise combinations of unique communities as defined by the grouping variable(s).
1 | pairwise.jaccard(x, species = "Species", func = "Function")
|
x |
A grouped data set, with grouping variables defined as in dplyr operations |
species |
The name of the column in |
func |
The name of the column in |
This function returns a data set of the Jaccard 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.
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.jaccard(cms,species='species',func='func')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.