We all use the general libraries for data analysis and model fitting, but a nice thing with R is that you can interface any function with others. And a bunch of packages have been developed with ecological research in mind. Recently, Scott Chamberlain posted a good summary of new R libraries specifically useful for ecologists.
Dolph Schluter‘s page and Rodney Dyer‘s page have interesting tips for using R in evolutionary ecology and population genetics, respectively. An additional R resource for ecologists is the R programming resource center at NCEAS and the CRAN Task View for Analysis of Ecological and Environmental Data. Finally, ecological analysis with R was the core subject of a special issue of the Journal of Statistical Software in 2007.
Here is my summary of useful R packages for ecologists. I’m including here those packages that I consider more directly related to ecology and that I’ve used most. Obviously we all use many R packages for ecological research, but the idea here is to summarize those that specifically address ecological research. Some of those libraries might remain “hidden” amidst the zillions of libraries available in R. useRs interested in ecological research should consult additional R Task Views, such as the Spatial view. Additional interesting stuff for ecologists is also available in the Genetics, Multivariate, Phylogenetics and Cluster task views, among others.
General libraries for ecological research, with multiple functions
ade4. Analysis of ecological data with exploratory and euclidean methods in environmental sciences. Basically a series of functions for multivariate data analysis and graphics. true web page is here. It also has a GUI (graphic user interface), ade4TkGUI.
adehabitatHR. A collection of tools for the estimation of home range in animals.
adehabitatHS. A collection of tools for the analysis of habitat selection by animals.
adehabitatLT. A collection of tools for the analysis of animal movement patterns.
BiodiversityR. Statistical analysis of biodiversity patterns. This is a GUI (Graphical User Interface, via the R-Commander) and some utility functions (often based on the vegan package) for statistical analysis of biodiversity and ecological communities, including species accumulation curves, diversity indices, Renyi profiles, GLMs for analysis of species abundance and presence-absence, distance matrices, Mantel tests, and cluster, constrained and unconstrained ordination analysis. A book on biodiversity and community ecology analysis is available for free download from the website.
vegan. Ordination methods, diversity analysis and other functions for community and vegetation ecologists.
ecodist. Dissimilarity-based analysis functions including ordination and Mantel test functions, intended for use with spatial and community data.
bio.infer. Predict environmental conditions from biological observations.
meta. Functions for meta.analysis. Fixed and random effects meta-analysis. Functions for tests of bias, forest and funnel plot.
mra. Analysis of mark-recapture data using covariates. Models: CJS open population; Huggin’s closed population. Link functions: logit, sine, hazard. Model selection and model averaging routines. Plot methods. Simulation routine. CJS methods produce estimates of population size using the Horvitz-Thompson estimator.
popbio. Analysis of matrix population models. Construct and analyze projection matrix models from a demography study of marked individuals classified by age or stage. The package covers methods described in Matrix Population Models by Caswell (2001) and Quantitative Conservation Biology by Morris and Doak (2002).
Hmisc. Functions useful for ecological data analysis, high-level graphics, utility operations, computing sample size and power, imputing missing values, advanced table making, etc.
vegclust. Fuzzy clustering of vegetation data. This package contains functions used to perform fuzzy clustering of vegetation data under different models.
demoniche. An R-package for simulating spatially-explicit population dynamics. Nenzén et al. 2012. Ecography, 35: 577–580. doi: 10.1111/j.1600-0587.2012.07378.x.
BioMod. Functions for ensemble forecasting of species distributions, enabling the treatment of a range of methodological uncertainties in models and the examination of species-environment relationships. Thuillier et al. 2009. Ecography 32, 369–373. doi: 10.1111/j.1600-0587.2008.05742.x.
simecol. Simulation of ecological (and other) dynamic systems. Object oriented framework to simulate ecological (and other) dynamic systems. It can be used for differential equations, individual-based (or agent-based) and other models as well. The package helps to organize scenarios (avoids copy and paste) and improves readability and usability of code.
fossil. Palaeoecological and palaeogeographical analysis tools. A set of analytical tools useful in analysing ecological and geographical data sets, both ancient and modern. The package includes functions for estimating species richness (Chao 1 and 2, ACE, ICE, Jacknife), shared species/beta diversity, species area curves and geographic distances and areas.
Spatial ecology. Also see the Spatial R Task View.
spatstat. A package for analysing spatial data, mainly Spatial Point Patterns, including multitype/marked points and spatial covariates, in any two-dimensional spatial region. Also supports three-dimensional point patterns, and space-time point patterns in any number of dimensions.
spdep. Spatial dependence: weighting schemes, statistics and models. A collection of functions to create spatial weights matrix objects from polygon contiguities, from point patterns by distance and tesselations, for summarising these objects, and for permitting their use in spatial data analysis, including regional aggregation by minimum spanning tree; a collection of tests for spatial autocorrelation, including global Moran’s I, APLE, Geary’s C, Hubert/Mantel general cross product statistic, etc.
ecespa. Functions for spatial point pattern analysis. Some wrappers, functions and data sets for for spatial point pattern analysis (mainly based on spatstat), used in the book “Introducción al Análisis Espacial de Datos en Ecología y Ciencias Ambientales: Métodos y Aplicaciones”, by Marcelino de la Cruz.
spatial. Functions for kriging and point pattern analysis.
SpatialEpi. Various spatial epidemiological analyses. Cluster detection, disease mapping.
geoR. Analysis of geostatistical data. Geostatistical analysis including traditional, likelihood-based and Bayesian methods.
Geneland. Functions for detecting spatial structures from genetic data within a Bayesian framework via MCMC estimation.
adegenet. Implements a number of different methods for analysing population structure using multivariate statistics, graphics and spatial statistics.
I don’t like the name ‘network ecology’, but you probably know what I mean. R libraries developed by social scientists (e.g., sna) provide many useful functions for ecological research.
bipartite. Visualising bipartite networks and calculating some (ecological) indices. Bipartite provides functions to visualise webs and calculate a series of indices commonly used to describe pattern in ecological webs. It focusses on webs consisting of only two trophic levels, e.g. pollination webs or predator-prey-webs. Visualisation is important to get an idea of what we are actually looking at, while the indices summarise different aspects of the webs topology.
sna. Tools for Social Network Analysis. A range of tools for social network analysis, including node and graph-level indices, structural distance and covariance methods, structural equivalence detection, p* modeling, random graph generation, and 2D/3D network visualization.
igraph. Network analysis and visualization. Routines for simple graphs and network analysis. igraph can handle large graphs very well and provides functions for generating random and regular graphs, graph visualization, centrality indices, etc.
tnet. Analysis of Weighted, Two-mode, and Longitudinal networks.
ape. Analyses of phylogenetics and evolution.
picante. Phylocom integration, community analyses, null-models, traits and evolution.
geiger. Analysis of evolutionary diversification. Running macroevolutionary simulation, and estimating parameters related to diversification from comparative phylogenetic data.
adephylo. Exploratory analyses for the phylogenetic comparative method. Multivariate tools to analyze comparative data, i.e. a phylogeny and some traits measured for each taxa., community analyses, null-models, traits and evolution in R.
spacodiR. Spatial and phylogenetic analysis of community diversity. SPACoDi is primarily designed to characterise the structure and phylogenetic diversity of communities using abundance or presence-absence data of species among community plots.
phylobase. Base package for phylogenetic structures and comparative data.
ouch. Fit and compare Ornstein-Uhlenbeck models for evolution along a phylogenetic tree.
phangorn. Phylogenetic analysis in R: estimation of phylogenetic trees and networks using maximum likelihood, maximum parsimony, distance methods & Hadamard conjugation.
paleotree. Paleontological and phylogenetic analyses of evolution. Analyzes, time-scales and simulates phylogenies of extinct/fossil lineages, along with calculation of diversity curves. Also fits likelihood models to estimate sampling rates from stratigraphic ranges.
phylotools. Phylogenetic tools for eco-phylogenetics. Building supermatrix for DNA barcodes using different genes, calculating the inequality among lineages and phylogenetic similarity for very large dataset using slicing methods by invoking Phylocom.
Note: To automatically install the R Task Views (i.e., groups of packages useful for some specific analysis and pre-bundled in CRAN), the ctv package needs to be installed, e.g.:
the views can then be installed via install.views or update.views (which first assesses which of the packages are already installed and up-to-date), e.g.,