Skip to content

Instantly share code, notes, and snippets.

@sckott
Created May 1, 2014 01:02
Show Gist options
  • Save sckott/323cb0bf90c5e362738f to your computer and use it in GitHub Desktop.
Save sckott/323cb0bf90c5e362738f to your computer and use it in GitHub Desktop.

Install the development version

install.packages("devtools")
library("devtools")
install_github("ropensci/taxize")

Load the library

library("taxize")

This works now (there was a slight bug when no accepted names were found), this id doesn't have any accepted names, but of course others do

tp_accnames(25509881)
## http://services.tropicos.org/Name/25509881/AcceptedNames?apikey=f3e499d4-1519-42c9-afd1-685a16882f5a&format=json
##                          Error 
## "No accepted names were found"

Your species list

sps <- c("Justicia brasiliana", "Achatocarpus spinulosus", "Cordilyne dracaenoides", 
    "Astronium concinnum", "Astronium fraxinifolium", "Astronium graveolens", 
    "Astronium nelson-rosae", "Myracrodruon urundeuva", "Schinopsis brasiliensis", 
    "Schinus polygamus")

You were passing in a string of names as a factor class as i could detect from the code you sent, I've fixed in the new version on github so the function converts to character for you. All these should work, though many names are missing. Note that ITIS (using the function get_tsn) is mostly North America focused.

get_tpsid(sciname = sps)
## 
## Retrieving data for taxon 'Justicia brasiliana'
## 
## 
## Retrieving data for taxon 'Achatocarpus spinulosus'
## 
## 
## Retrieving data for taxon 'Cordilyne dracaenoides'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium concinnum'
## 
## 
## Retrieving data for taxon 'Astronium fraxinifolium'
## 
## 
## 
## 
## 
## More than one tpsid found for taxon 'Astronium fraxinifolium'!
## 
##           Enter rownumber of taxon (other inputs will return 'NA'):
##       tpsid                                       name rank     status
## 1   1300083                    Astronium fraxinifolium  sp. No opinion
## 2   1300084    Astronium fraxinifolium fo. glaberrimum  fo. No opinion
## 3   1300085    Astronium fraxinifolium fo. subglabrium  fo. No opinion
## 4   1300764       Astronium fraxinifolium var. glabrum var. No opinion
## 5   1301070    Astronium fraxinifolium fo. mollissimum  fo. No opinion
## 6  50227670 Astronium fraxinifolium var. fraxinifolium var. No opinion
## 7 100295291        Astronium fraxinifolium fo. pilosum  fo. No opinion
## Input accepted, took tpsid '1300083'.
## 
## 
## Retrieving data for taxon 'Astronium graveolens'
## 
## 
## 
## 
## 
## More than one tpsid found for taxon 'Astronium graveolens'!
## 
##           Enter rownumber of taxon (other inputs will return 'NA'):
##       tpsid                                    name rank       status
## 1   1300086                    Astronium graveolens  sp.   No opinion
## 2   1300087      Astronium graveolens var. brenesii var.   No opinion
## 3   1300088      Astronium graveolens var. dugandii var.   No opinion
## 4   1300089  Astronium graveolens var. planchoniana var. Illegitimate
## 5   1300971      Astronium graveolens var. inodorum var.   No opinion
## 6   1300972   Astronium graveolens var. brasiliense var.   No opinion
## 7   1301069  Astronium graveolens var. brasiliensis var.   No opinion
## 8  50227672    Astronium graveolens var. graveolens var.   No opinion
## 9 100295293 Astronium graveolens var. planchonianum var.   No opinion
## Input accepted, took tpsid '1300086'.
## 
## 
## Retrieving data for taxon 'Astronium nelson-rosae'
## 
## 
## Retrieving data for taxon 'Myracrodruon urundeuva'
## 
## 
## Retrieving data for taxon 'Schinopsis brasiliensis'
## 
## 
## 
## 
## 
## More than one tpsid found for taxon 'Schinopsis brasiliensis'!
## 
##           Enter rownumber of taxon (other inputs will return 'NA'):
##     tpsid                                name rank     status
## 1 1300195             Schinopsis brasiliensis  sp. No opinion
## 2 1300196 Schinopsis brasiliensis var. glabra var. No opinion
## Input accepted, took tpsid '1300195'.
## 
## 
## Retrieving data for taxon 'Schinus polygamus'
##  [1] "101666"    "24800177"  NA          "50227677"  "1300083"  
##  [6] "1300086"   "50227682"  "1300765"   "1300195"   "100350085"
## attr(,"class")
## [1] "tpsid"
get_tsn(sps)
## 
## Retrieving data for taxon 'Justicia brasiliana'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Achatocarpus spinulosus'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Cordilyne dracaenoides'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium concinnum'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium fraxinifolium'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium graveolens'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium nelson-rosae'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Myracrodruon urundeuva'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Schinopsis brasiliensis'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Schinus polygamus'
##  [1] NA       NA       NA       NA       NA       NA       NA      
##  [8] NA       NA       "507160"
## attr(,"match")
##  [1] "found" "found" "found" "found" "found" "found" "found" "found"
##  [9] "found" "found"
## attr(,"class")
## [1] "tsn"
get_ids(sps, db = "ncbi")
## 
## Retrieving data for taxon 'Justicia brasiliana'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Achatocarpus spinulosus'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Cordilyne dracaenoides'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Astronium concinnum'
## 
## 
## Retrieving data for taxon 'Astronium fraxinifolium'
## 
## 
## Retrieving data for taxon 'Astronium graveolens'
## 
## 
## Retrieving data for taxon 'Astronium nelson-rosae'
## 
## Not found. Consider checking the spelling or alternate classification
## 
## Retrieving data for taxon 'Myracrodruon urundeuva'
## 
## 
## Retrieving data for taxon 'Schinopsis brasiliensis'
## 
## 
## Retrieving data for taxon 'Schinus polygamus'
## 
## Not found. Consider checking the spelling or alternate classification
## $ncbi
##     Justicia brasiliana Achatocarpus spinulosus  Cordilyne dracaenoides 
##                      NA                      NA                      NA 
##     Astronium concinnum Astronium fraxinifolium    Astronium graveolens 
##                "676609"                "289699"                "263456" 
##  Astronium nelson-rosae  Myracrodruon urundeuva Schinopsis brasiliensis 
##                      NA                "261998"                "270267" 
##       Schinus polygamus 
##                      NA 
## attr(,"match")
##  [1] "not found" "not found" "not found" "found"     "found"    
##  [6] "found"     "not found" "found"     "found"     "not found"
## attr(,"class")
## [1] "uid"
## 
## attr(,"class")
## [1] "ids"

You said

I would also like to know the name accepted according to "Catalogue of Vascular Plant Species of Central and Northeastern Brazil" but I haven´t decipher how to do this

There is a service called the global names resolver. You can see what data_source_ids to use by using gnr_datasources

head(gnr_datasources())
##   id                    title
## 1  1        Catalogue of Life
## 2  2              Wikispecies
## 3  3                     ITIS
## 4  4                     NCBI
## 5  5           Index Fungorum
## 6  6 GRIN Taxonomy for Plants

The Brazil catalogue is number 145

gnr_resolve(sps, data_source_ids = 145)
##             submitted_name                                matched_name
## 2  Achatocarpus spinulosus                                            
## 4      Astronium concinnum                                   Astronium
## 5  Astronium fraxinifolium              Astronium fraxinifolium Schott
## 6     Astronium graveolens                                   Astronium
## 7   Astronium nelson-rosae               Astronium nelson-rosae Santin
## 3   Cordilyne dracaenoides                                            
## 1      Justicia brasiliana                    Justicia brasiliana Roth
## 8   Myracrodruon urundeuva Myracrodruon urundeuva Allemão & M. Allemão
## 9  Schinopsis brasiliensis               Schinopsis brasiliensis Engl.
## 10       Schinus polygamus                                     Schinus
##                                                         data_source_title
## 2                                                                        
## 4  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 5  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 6  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 7  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 3                                                                        
## 1  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 8  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 9  Catalogue of Vascular Plant Species of Central and Northeastern Brazil
## 10 Catalogue of Vascular Plant Species of Central and Northeastern Brazil
##    score
## 2    NaN
## 4  0.750
## 5  0.988
## 6  0.750
## 7  0.988
## 3    NaN
## 1  0.988
## 8  0.988
## 9  0.988
## 10 0.750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment