29 Jun 2012

Use IUCN API with R & XPath

Thanks to a posting on R-sig-eco mailing list I learned of the IUCN-API. Here's a simple example for what can be done with it (output as pdf is HERE):


25 Jun 2012

Avoid Overplotting of Text in Ordination Diagram

Referring to a recent posting on r-sig-eco mailing list I'll add this example to theBioBucket:














library(vegan)
library(vegan)
data(dune)
sol <- metaMDS(dune)
 
# use ordipointlabel -
# here is an example where I added cex according to species frequencies:
plot(sol, type = "n")
cex.lab = colSums(dune > 0) / nrow(dune) + 1
col.lab = rgb(0.2, 0.5, 0.4, alpha = 0.6)
ordipointlabel(sol, displ = "sp", col = col.lab, cex = cex.lab)
 
 
# you could also use pointLabel() from maptools package:
library(maptools)
x = as.vector(sol$species[,1])
y = as.vector(sol$species[,2])
w = row.names(sol$species)
 
plot(sol, type = "n")
points(sol, displ = "species", cex = 1, pch = 4, col = 3)
pointLabel(x, y, w, col = col.lab, cex = cex.lab)

19 Jun 2012

A Wrapper Function for Instant Package Installation / Loading

Since library() and require() only accept input with length(input) = 1 it is necessary to make repeated calls - this can be quite annoying.. So, HERE is a little wrapper function for convenient package installation / loading. It installs packages if they are missing and loads them if there were not loaded yet. I have put it to my RProfile.site so I can conveniently install / load packages with only one call and am quite content with it..

11 Jun 2012

FloraWeb Plant Species Report via R

For German-spoken users I added the function floraweb_scrape.R that allows you to conveniently collect species data and print to a PDF-file (see this example output). The function accesses data provided by the  web-site FloraWeb.de (BfN - Bundesministerium für Naturschutz).
You can use it as an interactive version (RTclTk) which I have put to a Github repository HERE.

Preview: