Code

Code

R packages and functions

FD: R package for measuring functional diversity from multiple traits, and other tools for functional ecology (available from CRAN)

metacor: R package for meta-analysis with correlation coefficients as effect sizes. Implements the DerSimonian-Laird (DSL) and Olkin-Pratt approaches, as described by Schulze (2004). (available from CRAN)

R functions

This sections includes random R functions that haven’t found their way in a package but may nevertheless be useful.
manovRDa: Two-way MANOVA-like RDA, with fixed or random factors (see Laliberté et al. 2009 Oecologia [PDF])

Maps of Australia for ggplot2

The oz package for

R allows you to draw a map of Australia. The ozRegion() function within this package returns the geographical data. However, the format of these data means that it could not be used directly by the ggplot2 package to get maps of Australia.

I converted the ozRegion() data to a data frame that can be directly used in ggplot2. See files below, some code, and resulting figures.

ozdata.rda (R data file)
ozdata.csv (CSV format)

Examples

# load packages and data
library(ggplot2)
load(“ozdata.rda”)

# map showing all states in different colours
qplot(long, lat, data = ozdata, geom = “polygon”, fill = state, main = “States of Australia”) + coord_equal()

# map showing coastline only
qplot(long, lat, data = subset(ozdata, border == “coast”), geom = “path”, fill = state, main = “Coastline of Australia”) + coord_equal()

# western australia only
qplot(long, lat, data = subset(ozdata, state == “WA”), geom = “polygon”, fill = I(“blue”), main = “WA only”) + coord_equal()

LyX & LaTeX

University of Canterbury LyX document class

I obtained the uocthesis.cls LaTeX class from the Computer Science Department. It was modified by the Maths Department to include a UC logo. I then created the uocthesis.layout file to port it to LyX.

Download the uocthesis.zip archive

Ecological metadata template

I wrote a LyX / LaTeX template for ecological metadata based on the official standard for the ecological sciences:

Michener, W. K., J. W. Brunt, J. J. Helly, T. B. Kirchner, and S. G. Stafford. 1997. Nongeospatial metadata for the ecological sciences. Ecological Applications 7:330-342. [PDF]

LyX or LaTex are great for writing metadata because one simply has to fill in the blanks without caring about format. LyX or LaTeX take care of the format automatically and generate a nice-looking pdf without any effort. LyX (and LaTeX) make it very easy to add references, cross-references, tables and figures to your metadata file, and format will always look great out of the box.

The resulting pdf can be attached with your data files when you share your data sets with others, or if you want to submit your data set to Ecology as a Data Paper, for example.

See the pdf example

Download the LyX template or the LaTeX template