Mean Rank Shifts


A measure of the relative change in species rank abundances, which indicates shifts in relative abundances over time (Collins et al. 2008). Mean rank shifts are calculated as the average difference in species' ranks between consecutive time periods, among species that are present across the entire time series.


mean_rank_shift(df, time.var, species.var, abundance.var,
  replicate.var = as.character(NA))



A data frame containing time, species and abundance columns and an optional column of replicates


The name of the time column


The name of the species column


The name of the abundance column


The name of the optional replicate column


The input data frame needs to contain columns for time, species and abundance; time.var, species.var and abundance.var are used to indicate which columns contain those variables. If multiple replicates are included in the data frame, that column should be specified with replicate.var. Each replicate should reflect a single experimental unit - there must be a single abundance value per species within each time point and replicate.


mean_rank_shift returns a data frame with the following columns:

  • time.var_pair: A factor column that returns the two time periods being compared, separated by a dash. The name of this column is the same as the time.var column in the input dataframe followed by "_pair".

  • MRS: A numeric column with the mean rank shift values.

  • replicate.var: A column that has same name and type as the replicate.var column, if replication is specified.

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus