Supplement 2. Community assembly simulation code for use in the R programming language.

2016-08-03T16:18:00Z (GMT) by Nathan J. B. Kraft David D. Ackerly
<h2>File List</h2><blockquote> <p><a href="sup_files/community_assembly_simulations.txt">community_assembly_simulations.txt</a> </p> </blockquote><h2>Description</h2><blockquote> <p>A set of functions in the R programming language for simulating community assembly randomly (with or without weighting species by abundance), by trait-based competition, or by trait-based habitat filtering. The linked text file contains a series of R functions, a brief demonstration of the functions, commentary on the algorithms, and references. There are three key functions, described below, and a series of smaller functions that support them. More detailed descriptions can be found as in the file itself.</p> random_assembly(pool, final_richness, abund=NULL)<br> <blockquote> <p>Randomly samples final_richness number of species from a vector of species names given in pool. Sampling is occurence weighted if a vector of abundances is specified in the abund argument- default is no abundance weighting. </p> </blockquote> compete_until(nfinal, community)<br> <blockquote> <p>Takes a data frame community with species names in column 1 and traits in subsequent columns and runs a competition algorithm to cull the community unitl nfinal taxa remain. At each step, the algorithm identifies the most similar pair of species based on trait similarity and randomly removes one. Ties are broken randomly.</p> </blockquote> filter_until(nfinal, community, optima) <blockquote> <p>Takes a data frame community with species names in column 1 and traits in subsequent columns and runs a habitat filtering algorithm to cull the community unitl nfinal taxa remain. At each step, the algorithm identifies the species that is farthest from the trait optima and removes it. Ties are broken randomly. The community can have from 1 to many traits, but the optima vector must have the same number of elements as the number of traits in the community dataframe.</p> </blockquote> </blockquote>