RAC_difference: Rank Abundance Curve Differences

Description Usage Arguments Value References Examples

View source: R/RAC_difference.R

Description

Calculates differences between two samples for four comparable aspects of rank abundance curves (richness, evenness, rank, species composition). There are three ways differences can be calculated. 1) Between treatments within a block (note: block.var and treatment.var need to be specified). 2) Between treatments, pooling all replicates into a single species pool (note: pool = TRUE, treatment.var needs to be specified, and block.var will be NULL). 3) All pairwise combinations between all replicates (note: block.var = NULL, pool = FALSE and specifying treatment.var is optional. If treatment.var is specified, the treatment that each replicate belongs to will also be listed in the output).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
RAC_difference(
  df,
  time.var = NULL,
  species.var,
  abundance.var,
  replicate.var,
  treatment.var = NULL,
  pool = FALSE,
  block.var = NULL,
  reference.treatment = NULL
)

Arguments

df

A data frame containing a species, abundance, and replicate columns and optional time, treatment, and block columns.

time.var

The name of the optional time column.

species.var

The name of the species column.

abundance.var

The name of the abundance column.

replicate.var

The name of the replicate column. Replicate identifiers must be unique within the dataset and cannot be nested within treatments or blocks.

treatment.var

The name of the optional treatment column.

pool

An argument to allow abundance values to be pooled within a treatment. The default value is "FALSE", a value of "TRUE" averages abundance of each species within a treatment at a given time point.

block.var

The name of the optional block column.

reference.treatment

The name of the optional treatment that all other treatments will be compared to (e.g. only controls will be compared to all other treatments). If not specified all pairwise treatment comparisons will be made.

Value

The RAC_difference function returns a data frame with the following attributes:

References

Avolio et al. Submitted

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
data(pplots)
# With block and no time
df <- subset(pplots, year == 2002 & block < 3)
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               treatment.var = 'treatment',
               block.var = "block",
               replicate.var = "plot")

# With blocks and time
df <- subset(pplots, year < 2004 & block < 3)
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               treatment.var = 'treatment',
               block.var = "block",
               replicate.var = "plot",
               time.var = "year")

# With blocks, time and reference treatment
df <- subset(pplots, year < 2004 & block < 3)
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               treatment.var = 'treatment',
               block.var = "block",
               replicate.var = "plot",
               time.var = "year",
               reference.treatment = "N1P0")

# Pooling by treatment with time
df <- subset(pplots, year < 2004)
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               treatment.var = 'treatment',
               pool = TRUE,
               replicate.var = "plot",
               time.var = "year")

# All pairwise replicates with treatment
df <- subset(pplots, year < 2004 & plot %in% c(21, 25, 32))
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               replicate.var = "plot",
               time.var = "year",
               treatment.var = "treatment")

# All pairwise replicates without treatment
df <- subset(pplots, year < 2004 & plot %in% c(21, 25, 32))
RAC_difference(df = df,
               species.var = "species",
               abundance.var = "relative_cover",
               replicate.var = "plot",
               time.var = "year")

Example output

  block plot plot2 treatment treatment2 richness_diff evenness_diff rank_diff
1     1   25    29      N1P0       N2P0    0.00000000  -0.001809309 0.1404959
2     2   27    32      N1P0       N2P0    0.08695652   0.001404158 0.1455577
3     1   25    13      N1P0       N2P3    0.04166667   0.010224629 0.1788194
4     2   27    21      N1P0       N2P3    0.00000000  -0.042893611 0.1965974
5     1   29    13      N2P0       N2P3    0.04000000   0.012014700 0.1600000
6     2   32    21      N2P0       N2P3   -0.08333333  -0.044237256 0.1597222
  species_diff
1    0.3636364
2    0.3478261
3    0.4583333
4    0.4347826
5    0.5200000
6    0.4166667
   year block plot plot2 treatment treatment2 richness_diff evenness_diff
1  2002     1   25    29      N1P0       N2P0    0.00000000  -0.001809309
2  2002     2   27    32      N1P0       N2P0    0.08695652   0.001404158
3  2003     1   25    29      N1P0       N2P0    0.13636364   0.036330206
4  2003     2   27    32      N1P0       N2P0    0.19230769   0.149095677
5  2002     1   25    13      N1P0       N2P3    0.04166667   0.010224629
6  2002     2   27    21      N1P0       N2P3    0.00000000  -0.042893611
7  2003     1   25    13      N1P0       N2P3   -0.04761905   0.064059578
8  2003     2   27    21      N1P0       N2P3    0.00000000   0.013942131
9  2002     1   29    13      N2P0       N2P3    0.04000000   0.012014700
10 2002     2   32    21      N2P0       N2P3   -0.08333333  -0.044237256
11 2003     1   29    13      N2P0       N2P3   -0.17391304   0.027581827
12 2003     2   32    21      N2P0       N2P3   -0.18518519  -0.135054540
   rank_diff species_diff
1  0.1404959    0.3636364
2  0.1455577    0.3478261
3  0.2128099    0.5000000
4  0.1656805    0.5769231
5  0.1788194    0.4583333
6  0.1965974    0.4347826
7  0.2018141    0.6190476
8  0.1788194    0.6666667
9  0.1600000    0.5200000
10 0.1597222    0.4166667
11 0.1776938    0.6086957
12 0.1865569    0.6296296
  year block plot plot2 treatment treatment2 richness_diff evenness_diff
1 2002     1   25    29      N1P0       N2P0    0.00000000  -0.001809309
2 2002     2   27    32      N1P0       N2P0    0.08695652   0.001404158
3 2003     1   25    29      N1P0       N2P0    0.13636364   0.036330206
4 2003     2   27    32      N1P0       N2P0    0.19230769   0.149095677
5 2002     1   25    13      N1P0       N2P3    0.04166667   0.010224629
6 2002     2   27    21      N1P0       N2P3    0.00000000  -0.042893611
7 2003     1   25    13      N1P0       N2P3   -0.04761905   0.064059578
8 2003     2   27    21      N1P0       N2P3    0.00000000   0.013942131
  rank_diff species_diff
1 0.1404959    0.3636364
2 0.1455577    0.3478261
3 0.2128099    0.5000000
4 0.1656805    0.5769231
5 0.1788194    0.4583333
6 0.1965974    0.4347826
7 0.2018141    0.6190476
8 0.1788194    0.6666667
  year treatment treatment2 richness_diff evenness_diff rank_diff species_diff
1 2002      N1P0       N2P0    0.02439024  -0.031043940 0.1171921    0.3658537
2 2003      N1P0       N2P0   -0.05128205  -0.001299208 0.1157133    0.3076923
3 2002      N1P0       N2P3    0.04761905   0.005877324 0.1439909    0.3809524
4 2003      N1P0       N2P3    0.00000000  -0.013034145 0.1405896    0.3809524
5 2002      N2P0       N2P3    0.02222222   0.036852369 0.1545679    0.4666667
6 2003      N2P0       N2P3    0.04651163  -0.011731183 0.1471065    0.4651163
  year plot plot2 treatment treatment2 richness_diff evenness_diff rank_diff
1 2002   21    25      N2P3       N1P0    0.00000000   0.036178568 0.1983471
2 2003   21    25      N2P3       N1P0   -0.04761905   0.013428615 0.2018141
3 2002   21    32      N2P3       N2P0    0.08333333   0.044237256 0.1597222
4 2003   21    32      N2P3       N2P0    0.18518519   0.135054540 0.1865569
5 2002   25    32      N1P0       N2P0    0.08695652   0.008173823 0.1833648
6 2003   25    32      N1P0       N2P0    0.23076923   0.121868813 0.1923077
  species_diff
1    0.3636364
2    0.5238095
3    0.4166667
4    0.6296296
5    0.3478261
6    0.6153846
  year plot plot2 richness_diff evenness_diff rank_diff species_diff
1 2002   21    25    0.00000000   0.036178568 0.1983471    0.3636364
2 2003   21    25   -0.04761905   0.013428615 0.2018141    0.5238095
3 2002   21    32    0.08333333   0.044237256 0.1597222    0.4166667
4 2003   21    32    0.18518519   0.135054540 0.1865569    0.6296296
5 2002   25    32    0.08695652   0.008173823 0.1833648    0.3478261
6 2003   25    32    0.23076923   0.121868813 0.1923077    0.6153846

codyn documentation built on Dec. 1, 2020, 9:09 a.m.