This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example to get a density and population estimate for Karoo birds using publication | |
# https://tandfonline.com/doi/abs/10.2989/00306525.2018.1553804 | |
# Title: Modelling bird atlas reporting rate as a function of density in the southern Karoo, South Africa | |
# Make sure these packages are installed | |
library(RCurl); library(dplyr) | |
# What is the mass of your bird? | |
# Here we use as example Karoo Scrub-Robin | |
mass <- 20 | |
# What is the SABAP2 code for the species? | |
# Get this from: http://sabap2.adu.org.za/species |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Read in .csv from SABAP | |
occ<-read.csv("data.csv") | |
#retain only pentads with >4 cards with your species recorded | |
occ<-subset(occ,Cards_with_spp>4) | |
#retain only longitude and latitude of pentad centres and rename columns "lon, lat" | |
occ<-occ[,7:6] | |
names(occ)<-c("lon","lat") | |
#Convert sp spatial points DF | |
coordinates(occ) <- ~lon+lat | |
stdCRS <- CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Coverage Map | |
#=================================================== | |
# Loading and installing packages ----------------------------------------- | |
x <- c("ggmap", "rgdal", "rgeos", "maptools", "dplyr", "tmap", | |
"raster", "rJava","ggplot2", "sp") | |
install.packages(x) | |
lapply(x, library, character.only = TRUE) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Coverage Map | |
#=================================================== | |
# Loading and installing packages ----------------------------------------- | |
x <- c("ggmap", "rgdal", "rgeos", "maptools", "dplyr", "tmap", | |
"raster", "rJava","ggplot2", "sp") | |
install.packages(x) | |
lapply(x, library, character.only = TRUE) | |
#Read in the SABAP data |