worms (version 0.2.1)

wormsbynames: GET AphiaRecordsByNames

Description

takes character vector with taxon names and retrives AphiaRecords from WoRMS

Usage

wormsbynames(taxon_names, ids = FALSE, match = FALSE, verbose = TRUE,
  chunksize = 50, like = "false", marine_only = "true",
  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

match

taxon_names that could not retrieved will be retried with wormsbymatchnames. Implies "id=TRUE"

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

Add a "%"-sign after the ScientificName (SQL LIKE function). Default=true

marine_only

Limit to marine taxa. Default=true

sleep_btw_chunks_in_sec

pause between requests

Value

a data frame.

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.

Examples

Run this code
# NOT RUN {
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
# }
# NOT RUN {
w <- wormsbynames(taxon_names, match=TRUE)
# }
# NOT RUN {
## 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)

        
# }

Run the code above in your browser using DataCamp Workspace