Skip to content

Instantly share code, notes, and snippets.

@jebyrnes
Created January 28, 2014 19:46
Show Gist options
  • Save jebyrnes/8674787 to your computer and use it in GitHub Desktop.
Save jebyrnes/8674787 to your computer and use it in GitHub Desktop.
A quick script to get the order of a species if you know it's latin binomial name using the Reol library http://cran.r-project.org/web/packages/Reol/index.html
library(Reol)
getOrder <- function(binom_taxa, db = "NCBI Taxonomy"){
MyEOLs <- DownloadSearchedTaxa(binom_taxa, to.file=FALSE)
hier <- DownloadHierarchy(MyEOLs, FALSE, database=db)
taxonomic_info <- CombineHierarchyInfo(hier)
ord <- which(taxonomic_info[[2]]=="Order")
return(taxonomic_info[[1]][ord,1])
}
ord1 <- getOrder("Laminaria saccharina")
ord2 <- getOrder("Saccharina latissima")
ord1
ord2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment