I was having fun paying with the package dismo dismo and GBIF data when I discovered that using IAvH code you can download all the data set for Colombian institutions. So I decided to play with it.
Some tables still need some additional work to fix extra spaces and inconsistent characters. Plotting this data set you can see where mainly Colombian researchers have collected biodiversity.
Download the data (70 megas aprox) save in the path: /data/sib/. Because my laptop is old and low in RAM I avoided to load all the data set at once. So I created a loop that make this code very slow.
require(raster)
Loading required package: raster
Loading required package: sp
# get poligon Colombia
co <- getData("GADM", country = "CO", level = 1, download = TRUE)
# get altitude
alt <- getData("alt", country = "CO")
# set path to the the directory whth the files
direct <- as.data.frame(dir(path = "data/sib/"))
plot(alt)
temp <- data.frame()
for (i in 1:length(direct[, 1])) {
# read all tables
paste("temp", i, sep = "")
a <- read.csv(paste("data/sib/", direct[i, ], sep = ""), header = T, sep = "")
#
# print(paste('numeric',is.numeric(a$lon),is.numeric(a$lat),direct[i,],sep='
# ')) # line to chk table consistancy
points(as.numeric(a$lon), as.numeric(a$lat), col = "blue", cex = 0.3)
# temp<-rbind(temp,a) # uncoment to make produce one table
}
plot(co, border = "gray", add = T) #plot colomba polygon on top
The data set still have some problems with some points outside the political limit, but the work IAvH have done to convince other Colombian institutions to share their data and in georeferencing is remarkable.
Will be nice to add GBIF data and compare this against collections held outside Colombia. Also to use ggplot2 to see the points by institutions or taxa and do some simple statistics.
I had fun learning how to publish blog posts from R + knitr to WordPress. Next posts will be more interesting, I hope.