wormsbynames: GET AphiaRecordsByNames

Description Usage Arguments Details Value Examples

View source: R/worms_func.R

Description

takes character vector with taxon names and retrives AphiaRecords from WoRMS

Usage

1
2
3
wormsbynames(taxon_names, ids = FALSE, verbose = TRUE, chunksize = 50,
  like = TRUE, marine_only = FALSE, match = FALSE,
  sleep_btw_chunks_in_sec = 0.1)

Arguments

taxon_names

character vector with names of taxa to look up.

ids

add column "id" and "name" with running id and search names

verbose

be verbose

chunksize

there is a limit to the number of taxa that can be looked up at once, so request are split up into chunks. This limit seems to be variable. 50 is very safe.

like

Returns also entries of match_type 'like'. Default=TRUE

marine_only

Limit to marine taxa. Default=TRUE

match

TRUE for fuzzy name matching (AphiaRecordsByMatchNames). FALSE for default matching (AphiaRecordsByNames). Default=FALSE

sleep_btw_chunks_in_sec

pause between requests

Details

This function will take a character vector with taxon names, retrive AphiaRecords (CC-BY) from www.marinespecies.org using the GET /AphiaRecordsByName/ScientificName Method described at http://www.marinespecies.org/rest/. Results will be output to a data.frame with each row being a record. For each name given, only the one AphiaRecord will be retrived. AphiaRecord with "accepted" status are preferred. If not present last entry will be taken which seems to result in best results.

Value

a data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
taxon_names <- c( "Westwodilla caecula" ,  "Abra alba", "Chaetozone cf. setosa",  "Algae" )
w <- wormsbynames(taxon_names)
## print unrecognized returns
failed_species <- rownames(w[is.na(w[,1]),])

## try again with fuzzy matching turned on
w <- wormsbynames(taxon_names, match=TRUE)

## this is how to load taxon_names from file
write.csv(taxon_names , file = "tax.csv", 
        row.names = FALSE,
        na = "")
## check it out, then load it
read.csv(file = "tax.csv",
        na = "", 
        stringsAsFactors = FALSE,
        col.names = FALSE)
## save results to file to inspect with, e.g. spreadsheet software
write.csv(w,file = "aphiainfo.csv", 
        na = "", 
        col.names = TRUE,
        row.names = TRUE)

        

janhoo/worms documentation built on May 20, 2019, 2:45 p.m.