First load the package:

Occurrences

The occurrence() function provides access to raw occurrence data. For example, to fetch all occurrences by scientific name:

occurrence("Abra aequalis")
#> # A tibble: 767 x 99
#>    country date_year scientificNameID year  scientificName superfamilyid
#>    <chr>       <int> <chr>            <chr> <chr>                  <int>
#>  1 United…      1976 urn:lsid:marine… 1976  Abra aequalis          14636
#>  2 United…      1977 urn:lsid:marine… 1977  Abra aequalis          14636
#>  3 <NA>         1986 urn:lsid:marine… 1986  Abra aequalis          14636
#>  4 <NA>         2013 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  5 <NA>         1994 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  6 <NA>         1972 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  7 <NA>         1996 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  8 Colomb…      2001 urn:lsid:marine… 2001  Abra aequalis          14636
#>  9 <NA>         2013 urn:lsid:marine… <NA>  Abra aequalis          14636
#> 10 <NA>         2001 urn:lsid:marine… <NA>  Abra aequalis          14636
#> # … with 757 more rows, and 93 more variables: individualCount <chr>,
#> #   dropped <lgl>, aphiaID <int>, decimalLatitude <dbl>, subclassid <int>,
#> #   phylumid <int>, familyid <int>, basisOfRecord <chr>, subterclassid <int>,
#> #   maximumDepthInMeters <dbl>, id <chr>, day <chr>, order <chr>,
#> #   dataset_id <chr>, decimalLongitude <dbl>, collectionCode <chr>,
#> #   date_end <dbl>, speciesid <int>, superfamily <chr>, date_start <dbl>,
#> #   month <chr>, genus <chr>, bibliographicCitation <chr>, subterclass <chr>,
#> #   eventDate <chr>, superorder <chr>, coordinateUncertaintyInMeters <chr>,
#> #   absence <lgl>, superorderid <int>, genusid <int>,
#> #   originalScientificName <chr>, marine <lgl>, minimumDepthInMeters <dbl>,
#> #   infraclassid <int>, institutionCode <chr>, date_mid <dbl>,
#> #   infraclass <chr>, class <chr>, orderid <int>, waterBody <chr>,
#> #   kingdom <chr>, recordedBy <chr>, classid <int>, phylum <chr>,
#> #   species <chr>, subclass <chr>, family <chr>, kingdomid <int>,
#> #   node_id <chr>, flags <chr>, sss <dbl>, shoredistance <int>, sst <dbl>,
#> #   bathymetry <int>, dynamicProperties <chr>, catalogNumber <chr>,
#> #   locality <chr>, scientificNameAuthorship <chr>, identifiedBy <chr>,
#> #   depth <dbl>, type <chr>, taxonRemarks <chr>, occurrenceStatus <chr>,
#> #   materialSampleID <chr>, occurrenceID <chr>, ownerInstitutionCode <chr>,
#> #   samplingProtocol <chr>, taxonRank <chr>, datasetName <chr>,
#> #   datasetID <chr>, collectionID <chr>, eventID <chr>, habitat <chr>,
#> #   associatedMedia <lgl>, associatedSequences <lgl>, county <chr>,
#> #   coordinatePrecision <chr>, associatedReferences <chr>, fieldNumber <chr>,
#> #   stateProvince <chr>, preparations <chr>, occurrenceRemarks <chr>,
#> #   verbatimDepth <chr>, modified <lgl>, infraspecificEpithet <lgl>,
#> #   recordNumber <lgl>, higherGeography <chr>, continent <chr>,
#> #   typeStatus <lgl>, geodeticDatum <lgl>, specificEpithet <chr>,
#> #   georeferenceSources <lgl>, dateIdentified <chr>

Alternatively, occurrences can be fetched by AphiaID:

occurrence(taxonid = 293683)
#> # A tibble: 767 x 99
#>    country date_year scientificNameID year  scientificName superfamilyid
#>    <chr>       <int> <chr>            <chr> <chr>                  <int>
#>  1 United…      1976 urn:lsid:marine… 1976  Abra aequalis          14636
#>  2 United…      1977 urn:lsid:marine… 1977  Abra aequalis          14636
#>  3 <NA>         1986 urn:lsid:marine… 1986  Abra aequalis          14636
#>  4 <NA>         2013 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  5 <NA>         1994 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  6 <NA>         1972 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  7 <NA>         1996 urn:lsid:marine… <NA>  Abra aequalis          14636
#>  8 Colomb…      2001 urn:lsid:marine… 2001  Abra aequalis          14636
#>  9 <NA>         2013 urn:lsid:marine… <NA>  Abra aequalis          14636
#> 10 <NA>         2001 urn:lsid:marine… <NA>  Abra aequalis          14636
#> # … with 757 more rows, and 93 more variables: individualCount <chr>,
#> #   dropped <lgl>, aphiaID <int>, decimalLatitude <dbl>, subclassid <int>,
#> #   phylumid <int>, familyid <int>, basisOfRecord <chr>, subterclassid <int>,
#> #   maximumDepthInMeters <dbl>, id <chr>, day <chr>, order <chr>,
#> #   dataset_id <chr>, decimalLongitude <dbl>, collectionCode <chr>,
#> #   date_end <dbl>, speciesid <int>, superfamily <chr>, date_start <dbl>,
#> #   month <chr>, genus <chr>, bibliographicCitation <chr>, subterclass <chr>,
#> #   eventDate <chr>, superorder <chr>, coordinateUncertaintyInMeters <chr>,
#> #   absence <lgl>, superorderid <int>, genusid <int>,
#> #   originalScientificName <chr>, marine <lgl>, minimumDepthInMeters <dbl>,
#> #   infraclassid <int>, institutionCode <chr>, date_mid <dbl>,
#> #   infraclass <chr>, class <chr>, orderid <int>, waterBody <chr>,
#> #   kingdom <chr>, recordedBy <chr>, classid <int>, phylum <chr>,
#> #   species <chr>, subclass <chr>, family <chr>, kingdomid <int>,
#> #   node_id <chr>, flags <chr>, sss <dbl>, shoredistance <int>, sst <dbl>,
#> #   bathymetry <int>, dynamicProperties <chr>, catalogNumber <chr>,
#> #   locality <chr>, scientificNameAuthorship <chr>, identifiedBy <chr>,
#> #   depth <dbl>, type <chr>, taxonRemarks <chr>, occurrenceStatus <chr>,
#> #   materialSampleID <chr>, occurrenceID <chr>, ownerInstitutionCode <chr>,
#> #   samplingProtocol <chr>, taxonRank <chr>, datasetName <chr>,
#> #   datasetID <chr>, collectionID <chr>, eventID <chr>, habitat <chr>,
#> #   associatedMedia <lgl>, associatedSequences <lgl>, county <chr>,
#> #   coordinatePrecision <chr>, associatedReferences <chr>, fieldNumber <chr>,
#> #   stateProvince <chr>, preparations <chr>, occurrenceRemarks <chr>,
#> #   verbatimDepth <chr>, modified <lgl>, infraspecificEpithet <lgl>,
#> #   recordNumber <lgl>, higherGeography <chr>, continent <chr>,
#> #   typeStatus <lgl>, geodeticDatum <lgl>, specificEpithet <chr>,
#> #   georeferenceSources <lgl>, dateIdentified <chr>

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))")
#> # A tibble: 319 x 85
#>    date_year scientificNameID year  scientificName superfamilyid individualCount
#>        <int> <chr>            <chr> <chr>                  <int> <chr>          
#>  1      1984 urn:lsid:marine… 1984  Abra alba              14636 23.0           
#>  2      2009 urn:lsid:marine… 2009  Abra alba              14636 <NA>           
#>  3      2002 urn:lsid:marine… 2002  Abra alba              14636 <NA>           
#>  4      2002 urn:lsid:marine… 2002  Abra alba              14636 <NA>           
#>  5      1995 urn:lsid:marine… 1995  Abra alba              14636 78.0           
#>  6      2012 urn:lsid:marine… 2012  Abra alba              14636 <NA>           
#>  7      1999 urn:lsid:marine… 1999  Abra alba              14636 15.0           
#>  8      2010 urn:lsid:marine… 2010  Abra alba              14636 <NA>           
#>  9      1989 urn:lsid:marine… 1989  Abra alba              14636 47.0           
#> 10      1991 urn:lsid:marine… 1991  Abra alba              14636 103.0          
#> # … with 309 more rows, and 79 more variables: dropped <lgl>,
#> #   fieldNumber <chr>, aphiaID <int>, decimalLatitude <dbl>, subclassid <int>,
#> #   phylumid <int>, familyid <int>, catalogNumber <chr>,
#> #   occurrenceStatus <chr>, basisOfRecord <chr>, subterclassid <int>,
#> #   modified <chr>, maximumDepthInMeters <dbl>, id <chr>, day <chr>,
#> #   order <chr>, dataset_id <chr>, locality <chr>, decimalLongitude <dbl>,
#> #   collectionCode <chr>, date_end <dbl>, speciesid <int>, occurrenceID <chr>,
#> #   superfamily <chr>, date_start <dbl>, month <chr>, genus <chr>,
#> #   samplingProtocol <chr>, subterclass <chr>, eventDate <chr>, eventID <chr>,
#> #   superorder <chr>, absence <lgl>, samplingEffort <chr>, superorderid <int>,
#> #   genusid <int>, originalScientificName <chr>, marine <lgl>,
#> #   minimumDepthInMeters <dbl>, infraclassid <int>, institutionCode <chr>,
#> #   date_mid <dbl>, infraclass <chr>, class <chr>, orderid <int>, sex <chr>,
#> #   geodeticDatum <chr>, kingdom <chr>, recordedBy <chr>, classid <int>,
#> #   phylum <chr>, lifeStage <chr>, species <chr>, subclass <chr>,
#> #   datasetID <chr>, family <chr>, kingdomid <int>, node_id <chr>, flags <chr>,
#> #   sss <dbl>, shoredistance <int>, sst <dbl>, bathymetry <dbl>,
#> #   language <chr>, footprintSRS <chr>, datasetName <chr>, country <chr>,
#> #   references <chr>, dynamicProperties <chr>, bibliographicCitation <chr>,
#> #   continent <chr>, scientificNameAuthorship <chr>, specificEpithet <chr>,
#> #   verbatimDepth <chr>, occurrenceRemarks <chr>, footprintWKT <chr>,
#> #   locationID <chr>, depth <dbl>, eventTime <chr>

A convenience function map_leaflet() is provided to visualize occurrences on an interactive map:

map_leaflet(occurrence("Abra sibogai"))

Checklists

The checklist() function returns all taxa observed for a given set of filters.

checklist("Semelidae")
#> # A tibble: 108 x 38
#>    scientificName scientificNameA… taxonID taxonRank taxonomicStatus
#>    <chr>          <chr>              <int> <chr>     <chr>          
#>  1 Abra alba      (W. Wood, 1802)   141433 Species   accepted       
#>  2 Abra nitida    (O. F. Müller, …  141435 Species   accepted       
#>  3 Scrobicularia… (da Costa, 1778)  141424 Species   accepted       
#>  4 Abra prismati… (Montagu, 1808)   141436 Species   accepted       
#>  5 Abra tenuis    (Montagu, 1803)   141439 Species   accepted       
#>  6 Abra           Lamarck, 1818     138474 Genus     accepted       
#>  7 Theora lubrica Gould, 1861       233903 Species   accepted       
#>  8 Semelidae      Stoliczka, 1870…    1781 Family    accepted       
#>  9 Abra aequalis  (Say, 1822)       293683 Species   accepted       
#> 10 Abra segmentum (Récluz, 1843)    141438 Species   accepted       
#> # … with 98 more rows, and 33 more variables: acceptedNameUsage <chr>,
#> #   acceptedNameUsageID <int>, is_marine <lgl>, is_brackish <lgl>,
#> #   kingdom <chr>, phylum <chr>, class <chr>, subclass <chr>, infraclass <chr>,
#> #   subterclass <chr>, superorder <chr>, order <chr>, superfamily <chr>,
#> #   family <chr>, kingdomid <int>, phylumid <int>, classid <int>,
#> #   subclassid <int>, infraclassid <int>, subterclassid <int>,
#> #   superorderid <int>, orderid <int>, superfamilyid <int>, familyid <int>,
#> #   records <int>, genus <chr>, genusid <int>, species <chr>, speciesid <int>,
#> #   is_freshwater <lgl>, is_terrestrial <lgl>, subspecies <chr>,
#> #   subspeciesid <int>

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))")
#> # A tibble: 901 x 69
#>    scientificName taxonID taxonomicStatus acceptedNameUsa… acceptedNameUsa…
#>    <chr>            <int> <chr>           <chr>                       <int>
#>  1 Nematoda           799 accepted        Nematoda                      799
#>  2 Abra alba       141433 accepted        Abra alba                  141433
#>  3 Sabatieria ce…  121360 accepted        Sabatieria celt…           121360
#>  4 Sabatieria pu…  153130 accepted        Sabatieria punc…           153130
#>  5 Spiophanes bo…  131187 accepted        Spiophanes bomb…           131187
#>  6 Kurtiella bid…  345281 accepted        Kurtiella biden…           345281
#>  7 Nephtys hombe…  130359 accepted        Nephtys homberg…           130359
#>  8 Oligochaeta       2036 accepted        Oligochaeta                  2036
#>  9 Cirratulidae       919 accepted        Cirratulidae                  919
#> 10 Fabulina fabu…  146907 accepted        Fabulina fabula            146907
#> # … with 891 more rows, and 64 more variables: is_marine <lgl>,
#> #   is_brackish <lgl>, is_freshwater <lgl>, is_terrestrial <lgl>,
#> #   records <int>, taxonRank <chr>, kingdom <chr>, kingdomid <int>,
#> #   phylum <chr>, phylumid <int>, scientificNameAuthorship <chr>, class <chr>,
#> #   classid <int>, subclass <chr>, order <chr>, superfamily <chr>,
#> #   family <chr>, subclassid <int>, orderid <int>, superfamilyid <int>,
#> #   familyid <int>, infraclass <chr>, infraclassid <int>, subterclass <chr>,
#> #   superorder <chr>, subterclassid <int>, superorderid <int>, suborder <chr>,
#> #   suborderid <int>, subfamily <chr>, subfamilyid <int>, subphylum <chr>,
#> #   subphylumid <int>, superclass <chr>, superclassid <int>, subkingdom <chr>,
#> #   infrakingdom <chr>, subkingdomid <int>, infrakingdomid <int>, genus <chr>,
#> #   genusid <int>, infraphylum <chr>, infraphylumid <int>, species <chr>,
#> #   speciesid <int>, infraorder <chr>, parvorder <chr>, infraorderid <int>,
#> #   parvorderid <int>, tribe <chr>, tribeid <int>, subgenus <chr>,
#> #   subgenusid <int>, category <chr>, section <chr>, subsection <chr>,
#> #   sectionid <int>, subsectionid <int>, subspecies <chr>, subspeciesid <int>,
#> #   variety <chr>, varietyid <int>, forma <chr>, formaid <int>

Measurements and facts

The package also provides access to MeasurementOrFact records associated with occurrences. When calling occurrence(), MeasurementOrFact records can be included by setting mof = true.

occ <- occurrence("Abra tenuis", mof = TRUE)

MeasurementOrFact records are nested in the occurrence, but the measurements() 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.

mof <- measurements(occ, fields = c("scientificName", "decimalLongitude", "decimalLatitude"))
mof
#> # A tibble: 19,355 x 17
#>    scientificName decimalLongitude decimalLatitude measurementDete…
#>    <chr>                     <dbl>           <dbl> <chr>           
#>  1 Abra tenuis               -1.20            46.3 <NA>            
#>  2 Abra tenuis               -1.20            46.3 <NA>            
#>  3 Abra tenuis               -1.20            46.3 <NA>            
#>  4 Abra tenuis               -1.20            46.3 <NA>            
#>  5 Abra tenuis               -1.20            46.3 <NA>            
#>  6 Abra tenuis               -1.18            46.3 <NA>            
#>  7 Abra tenuis               -1.18            46.3 <NA>            
#>  8 Abra tenuis               -1.18            46.3 <NA>            
#>  9 Abra tenuis               -1.18            46.3 <NA>            
#> 10 Abra tenuis               -1.18            46.3 <NA>            
#> # … with 19,345 more rows, and 13 more variables: measurementAccuracy <chr>,
#> #   measurementValue <chr>, measurementRemarks <chr>, measurementValueID <chr>,
#> #   level <int>, occurrenceID <chr>, measurementUnit <chr>,
#> #   measurementDeterminedDate <chr>, measurementType <chr>,
#> #   measurementUnitID <chr>, measurementTypeID <chr>, measurementID <chr>,
#> #   measurementMethod <chr>

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") %>%
  measurements()
#> # A tibble: 29 x 15
#>    id    measurementDete… measurementAccu… measurementValue measurementRema…
#>    <chr> <lgl>            <lgl>            <chr>            <lgl>           
#>  1 1878… NA               NA               mire             NA              
#>  2 1878… NA               NA               0,12             NA              
#>  3 267d… NA               NA               mire             NA              
#>  4 267d… NA               NA               0,11             NA              
#>  5 26d2… NA               NA               mire             NA              
#>  6 26d2… NA               NA               0,25             NA              
#>  7 2924… NA               NA               mire, putrido    NA              
#>  8 2924… NA               NA               0,05             NA              
#>  9 3534… NA               NA               mire with debris NA              
#> 10 3534… NA               NA               0,05             NA              
#> # … with 19 more rows, and 10 more variables: measurementValueID <lgl>,
#> #   level <int>, occurrenceID <chr>, measurementUnit <chr>,
#> #   measurementDeterminedDate <lgl>, measurementType <chr>,
#> #   measurementUnitID <chr>, measurementTypeID <lgl>, measurementID <lgl>,
#> #   measurementMethod <lgl>