rspeciesLink: Gets occurrence data from speciesLink

View source: R/rspeciesLink.R

rspeciesLinkR Documentation

Gets occurrence data from speciesLink

Description

This function access version beta 0.1 of the [speciesLink API]https://api.splink.org.br/ and returns occurrence data of species.

Usage

rspeciesLink(
  dir = "results/",
  filename = "output",
  save = FALSE,
  basisOfRecord = NULL,
  family = NULL,
  species = NULL,
  collectionCode = NULL,
  country = NULL,
  stateProvince = NULL,
  county = NULL,
  Coordinates = NULL,
  CoordinatesQuality = NULL,
  Scope = NULL,
  Synonyms = "no synomyms",
  Typus = FALSE,
  Images = NULL,
  RedList = FALSE,
  MaxRecords = NULL,
  file.format = "csv",
  compress = FALSE
)

Arguments

dir

Path to directory where the file will be saved. Default is to create a "results/" directory

filename

Name of the output file

save

Logical. Save output to filename? Defaults to FALSE

basisOfRecord

Character. Any in 'PreservedSpecimen', 'LivingSpecimen', 'FossilSpecimen', 'HumanObservation', 'MachineObservation' or 'MaterialSample'. Default is 'PreservedSpecimen' for museum and herbarium search

family

Family name. More than one name should be concatenated in a vector

species

Genus or genus and epithet separated by space. More than one species can be concatenated into a vector. The request cannot be done with more than 50 species at a time. Use lapply, or any sort of loop when dealing with multiple species.

collectionCode

Any collection available at speciesLink. Example: ALCB, E, INPA, MOBOT_BR. Accepts a vector of names

country

Any country name. No ASCII characters allowed. Accepts a vector of names

stateProvince

Any state or province. No ASCII characters allowed. Accepts a vector of names

county

Any municipality name. No ASCII characters allowed. Accepts a vector of names

Coordinates

Specify if records should have coordinates. Default is "no check" but it also accepts "Yes", No", "Original", "Automatic", "Blocked" or "no check"

CoordinatesQuality

Any character in "Good" or "Bad" to select specific type of coordinates

Scope

Group to be required. If NULL searches all groups. Any in "plants", "animals", "microrganisms" or "fossils"

Synonyms

If species names should be checked for synonyms in a specific dictionary. Set to "species2000" for search in Catálogo da Vida species2000, "flora2020" for Flora do Brasil 2020, "MycoBank" for MycoBank, "AlgaeBase" for AlgaeBase, "DSMZ" for DSMZ Prokaryotic Nomenclature Up-to-Date, "Moure" for Catálogo de Abelhas Moure or "no synonyms".

Typus

Logic. If TRUE select only typus

Images

If select only records with images. Default is NULL. It accepts: "Yes", "Live", "Polen", "Wood"

RedList

Logic. If TRUE only species in the IUCN Red List are returned

MaxRecords

Numeric. Maximum number of records to be required

file.format

Character. The file extension to be used for saving ('csv' or 'rds'). Default to 'csv'.

compress

Logical. Should the file be compressed? Default to FALSE.

Details

The time necessary to download records from the speciesLink API will depend on the number of records and species in the query and from the speed of the internet connection.

The speciesLink API does not allow the download of ~50 or more taxa at a time. So to download records from larger lists of species, you will probably need to make the queries in a loop (see Examples).

Value

A data.frame with the search result, which can also be saved on disk

Author(s)

Sara Mortara

Examples

## Not run: 
# Example for a single species, saving into a file called "ex01"
ex01 <-
 rspeciesLink(filename = "ex01",
                    species =  c("Eugenia platyphylla"),
                    Scope = "plants")
# Use lapply or similar for more than 50 species
# Making a request for multiple species
sp_list <- lapply(sp, function(x) rspeciesLink(species = x,
                                              Scope = "plants",
                                              basisOfRecord = "PreservedSpecimen",
                                              Synonyms = "flora2020"))
# Adding species names to each element of the list
names(sp_list) = sp
# Binding all searchs and keeping a column w/ the named used in the search
sp_df <- bind_rows(sp_list, .id = "original_search")

## End(Not run)


LimaRAF/plantR documentation built on Jan. 1, 2023, 10:18 a.m.