WoRMS banner
Add search provider Add provider
Twitter: Latest updates @WRMarineSpecies

Calling the WoRMS webservice from R

This tutorial assumes you have installed R version 2.x or 3.x (<3.2) (See http://www.r-project.org/).
Available for MacOS X, Linux & Windows.

Paste the following code in the R Console (this is just an example)
install.packages("XML", dependencies = TRUE)
download.file("http://www.omegahat.org/Prerelease/XMLSchema_0.8-0.tar.gz", "XMLSchema")
install.packages("XMLSchema", type="source", repos = NULL)
download.file("http://www.omegahat.org/Prerelease/SSOAP_0.91-0.tar.gz", "SSOAP")
install.packages("SSOAP", type="source", repos = NULL)
w = processWSDL("http://www.marinespecies.org/aphia.php?p=soap&wsdl=1")
iface = genSOAPClientInterface(, w)
AphiaID = iface@functions$getAphiaID("Solea solea",1,('http://www.marinespecies.org/aphia.php?p=soap'))
#should output '[0] 127160'
You can also use the rOpenSci library 'taxizesoap', available here: https://github.com/ropensci/taxizesoap

Note 1: if you come across this error:
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
It means you have not the latest versions of SSOAP (0.91-0) and/or XMLSchema (0.8-0).

Note 2: when using the function getAphiaRecordByID(), the 'class' propery is empty. This looks like a limitation of the SSOAP package.

Download this example.
Download elaborate example.