Measurement of Biodiversity in R
This reposititory hosts an R package that is being developed for estimating biodiversity and the components of its change.
The concepts and methods behind this R package are described in two preprints that are both currently in review.
McGlinn, D.J. X. Xiao, F. May, S. Blowes, J. Chase, N. Gotelli, T. Knight, B. McGill, and O. Purschke. preprint. MoB (Measurement of Biodiversity): a method to separate the scale-dependent effects of species abundance distribution, density, and aggregation on diversity change. bioRxiv 244103. doi: https://doi.org/10.1101/244103.
Chase, J.M., B. McGill, D.J. McGlinn, F. May, S.A. Blowes, X. Xiao, T. Knight. prepint. Embracing scale-dependence to achieve a deeper understanding of biodiversity and its change across communities. bioRxiv 275701. doi: https://doi.org/10.1101/275701
How to install mobr
The easiest option is to install the package directly from GitHub using the package
devtools. If you do not already have
devtools installed then need to install it.
The package also requires the
dplyr package which has many dependencies. If you do
not already have the
dplyr package installed we suggest you install it and
all of its dependencies using :
Then check that
dplyr can be loaded with
Now you should be ready to go with the
The package vignette provides a useful walkthrough the package tools, but below is some example code that uses the two key analyses and related graphics.
library(mobr) data(inv_comm) data(inv_plot_attr) inv_mob_in = make_mob_in(inv_comm, inv_plot_attr) inv_stats = get_mob_stats(inv_mob_in, 'group') plot(inv_stats) inv_deltaS = get_delta_stats(inv_mob_in, 'group', ref_group='uninvaded', type='discrete', log_scale=TRUE) plot(inv_deltaS, 'invaded', 'uninvaded')
How to contribute to this project
Fork the repo to your local GitHub account
Clone your forked version of the repo to your machine
git clone email@example.com:your_user_name/mobr.git
- Link your local repo back to the master on MoBiodiv
git remote add upstream firstname.lastname@example.org:MoBiodiv/mobr.git
- Create a branch for your changes
git branch new_function
- Checkout your branch
git checkout new_function
- Make your commits on that branch and when you are done push it to your forked copy of the repo
git push origin new_function
Submit a pull request on the GitHub website by going to your forked copy of the repo and clicking on the pull request button
After your changes are merged with master you'll want to merge that update to master with your copies as well.
git pull upstream master git push origin master # delete your branch as its no longer needed git branch -d new_function
Before your start work on the project in the future you'll want to repeat step 8 so that your version of the repo does not become out-of-sync with the main repository.