Code for downloading and working with data from the African Bird Atlas Project
# ABAP
This packages provides functionality to access, download, and manipulate
data from the African Bird Atlas Project.
It is possible to download these same data using the ABAP
API, but being able to pull these data straight
into R, in a standard format, should make them more accessible, easier
to analyse, and eventually make our analyses more reliable and
reproducible.
There is another package named
`CWAC` that provides similar
functionality, but now to download count data from the Coordinated
Waterbird Counts project. In addition, there is a companion package the
`ABDtools` package, which
adds the functionality necessary to annotate different data formats
(points and polygons) with environmental information from the Google
Earth Engine data
catalog.
## INSTRUCTIONS TO INSTALL
To install `ABAP` from GitHub using the
remotes package, run:
``` r
install.packages("remotes")
remotes::install_github("AfricaBirdData/ABAP")
```
## DOWNLOAD ABAP DATA FOR A SPECIES
A typical workflow entails defining a region and a species of interest,
e.g. say we are interested in the occupancy of the African Black Duck in
the North West province of South Africa:
First find the ABAP code for the species:
``` r
library(ABAP)
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(dplyr, warn.conflicts = FALSE)
# We can search for all duck species
ducks # A tibble: 1 × 1
#> Spp
#>
#> 1 95
```
With our code (95) we can download the data recorded for the region of
interest:
``` r
my_det_data %
sample(10)
# We can now subset those pentads from the original data
det_data_sel %
st_as_sf(coords = c("lon", "lat"),
crs = 4326) %>% # this is WGS84
st_bbox() %>%
st_as_sfc()
# Extract pentads within your polygon
my_pentads %
filter(Pentad %in% my_pentads[,"pentad"])
# Plots
plot(st_geometry(nw_pentads), axes = TRUE, lwd = 0.1, cex.axis = 0.7)
plot(st_geometry(my_pentads), add = TRUE, col = "red", lwd = 0.1)
plot(st_geometry(my_pol), add …