cv_coef: Extracts conservation value coefficients from a pair a...

Description Usage Arguments Value Examples

Description

This function takes two community matrices and extracts 3 coefficients used to calculate conservation value metrics

Usage

1
cv_coef(x, y)

Arguments

x

A community matrix, with species in columns and samples in rows

y

A community matrix, with species in columns and samples in rows

Value

a list with $shared (the number of shared species), $unique_x (the number of species unique to community x) and $unique_y (the number of species unique to community y)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(community_data)

#Select all samples in Evironment 'A'
comm.A<-community_data[which(community_data$environment == "A"),]

# Select only the abundance matrix (columns 1 and 2 contain the 'environment' and 'sample' data)
comm.A <- comm.A[, 3:ncol(comm.A)]

#Select all samples in Evironment 'B'
comm.B<-community_data[which(community_data$environment == "B"),]

# Select only the abundance matrix (columns 1 and 2 contain the 'environment' and 'sample' data)
comm.B <- comm.B[, 3:ncol(comm.B)]

#Calculate coefficients
cv_coef(comm.A, comm.B)
$shared
[1] 29

$unique_x
[1] 0

$unique_y
[1] 1

fsfrazao/SharedS documentation built on July 1, 2019, 6:24 p.m.