Taxonomy in R

Hi there,
here is a r-snippet which i wrote to get new data out of a species list.
I have a species-list of insect-pollinated european grassland plants, which is a little to detailed for me.
Through filtering i want to get a subset list with only small herbs.
First i consulted the PESI-Portal for a taxamatch only to find out, that only 75% of my species are currently in the database (Acer campestre is not found?)
After that i searched for a smart solution in r and i found taxize, a newly package which queries different databases and has nice functions for taxonomic data management.
First i want to get familynames for each genus-species combination. My species list contains two columns with the genus and the species name.
See below my solution how to get a family name for each species.

# Load in the source package taxize and get familynames for taxa in splist
install_github("taxize_", "ropensci")

splist <- paste(data$Genus,data$Species,sep="_")
mat <- matrix(nrow=length(splist),ncol=2)
mat[,2] <- splist
for(i in seq(1:length(splist))){
 # I had to use a try, because some entries produce strange errors.
res <- try(expr=get_tsn(splist[i],"sciname", by_="name"),silent=T)
if(is.vector(res)) {
fam <- get_familyname(res)
mat[i,1] <- fam
print(paste(fam,splist[i],sep=" - "))

It’s kind of rough, but it works. Currently it runs through my plant-species list with over 1500 entries.
The output looks like this…

[1] "Asteraceae - Artemisia_scoparia"

[1] "Asteraceae - Artemisia_vulgaris"

[1] "Araceae - Arum_maculatum"

[1] "Rosaceae - Aruncus_dioicus"

[1] "Asclepiadaceae - Asclepias_syriaca"

[1] "Asparagaceae - Asparagus_officinalis"

Iam still looking for a solution how to get specific traits for every species, such as “Perennial or Annual” or “Grow height”.
Will report back, if i find something.


Tags: , , , ,

About Martin Jung

PhD researcher at the University of Sussex. Interested in nature conservation, ecology and biodiversity as well as statistics, GIS and 'big data'

One response to “Taxonomy in R”

  1. EDiLD says :

    There is for plant traits. It’s on the todo-list for taxize…

Sussex Research Hive

Supporting the research community at the University of Sussex

Small Pond Science

Research, teaching, and mentorship in the sciences

Landscape Ecology 2.0

intersecting landscape ecology, open science, and R


The Research Blog of IIASA

Jörg Steinkamps Blog

Mainly things about R, Linux and vegetation modeling

Amy Whitehead's Research

the ecological musings of a conservation biologist

Michael McCarthy's Research

School of BioSciences, The University of Melbourne

The Rostrum

science, statistics, policy and more


Environmental Change - Understand, Predict, Adapt

Dynamic Ecology

Multa novit vulpes


METeorological Visualisation Utilities using R for Science and Teaching

A Birder´s Blog

"Everybody loves what they know"


A new metric to quantify biodiversity response to fragmentation

Trust Me, I'm a Geographer

Using Technology to Explore Our World

Duncan Golicher's weblog

Research, scripts and life in Chiapas

%d bloggers like this: