The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This package is a client for the OBIS API. It includes functions for data access, as well as a few helper functions for visualizing occurrence data and extracting nested MeasurementOrFact or DNADerivedData records.
First some packages:
library(robis)
library(dplyr)
library(ggplot2)
The occurrence()
function provides access to raw
occurrence data. For example, to fetch all occurrences by scientific
name:
<- occurrence("Abra aequalis")
occ occ
ggplot(occ) +
geom_bar(aes(date_year), stat = "count", width = 1)
Alternatively, occurrences can be fetched by AphiaID:
occurrence(taxonid = 293683)
Other parameters include geometry
, which accepts
polygons in WKT format:
occurrence("Abra alba", geometry = "POLYGON ((2.59689 51.16772, 2.62436 51.14059, 2.76066 51.19225, 2.73216 51.20946, 2.59689 51.16772))")
WKT strings can be created by drawing on a map using the
get_geometry()
function.
A convenience function map_leaflet()
is provided to
visualize occurrences on an interactive map:
map_leaflet(occurrence("Abra sibogai"))
The checklist()
function returns all taxa observed for a
given set of filters.
<- checklist("Semelidae")
cl cl
ggplot(cl %>% filter(!is.na(genus))) +
geom_bar(aes(genus)) +
coord_flip() +
ylab("species count")
Just like the occurrence()
function,
checklist()
accepts WKT geometries:
checklist(geometry = "POLYGON ((2.59689 51.16772, 2.62436 51.14059, 2.76066 51.19225, 2.73216 51.20946, 2.59689 51.16772))")
The package also provides access to MeasurementOrFact records
associated with occurrences. When calling occurrence()
,
MeasurementOrFact records can be included by setting
mof = true
.
<- occurrence("Abra tenuis", mof = TRUE) occ
MeasurementOrFact records are nested in the occurrence, but the
unnest_extension()
function allows you to extract them to a
flat data frame. Use the fields
parameter to indicate which
occurrence fields need to be preserved in the measurements table.
<- unnest_extension(occ, extension = "MeasurementOrFact", fields = c("scientificName", "decimalLongitude", "decimalLatitude"))
mof mof
Note that the MeasurementOrFact fields can be used as parameters to
the occurrence()
function. For example, to only get
occurrences with associated biomass measurements:
library(dplyr)
occurrence("Abra tenuis", mof = TRUE, measurementtype = "biomass") %>%
unnest_extension(extension = "MeasurementOrFact")
Just like MeasurementOrFact records, nested DNADerivedData records can be extracted from the occurrence results.
<- occurrence("Prymnesiophyceae", datasetid = "62b97724-da17-4ca7-9b26-b2a22aeaab51", dna = TRUE)
occ occ
<- unnest_extension(occ, extension = "DNADerivedData", fields = c("scientificName"))
dna
%>%
dna select(scientificName, target_gene, DNA_sequence)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.