I've been trying to download a species list, then getting the traits for the list automatically.
However, there is a naming inconsistency in species names between function that gets you the occurrence/ranges of species, and the functions that gets the trait data.
The former need the species name with an underscore, while the latter need the species name separated by a space:
library("BIEN")
#> Warning: le package 'BIEN' a été compilé avec la version R 4.0.3
#> Le chargement a nécessité le package : RPostgreSQL
#> Warning: le package 'RPostgreSQL' a été compilé avec la version R 4.0.3
#> Le chargement a nécessité le package : DBI
#> Warning: le package 'DBI' a été compilé avec la version R 4.0.3
#> Type vignette("BIEN") or vignette("BIEN_tutorial") to get started
#>
# Ranges work with species names with underscores and without
# But always return species names *with* underscores
BIEN_ranges_load_species("Arnica_ovata")
#> class : SpatialPolygonsDataFrame
#> features : 1
#> extent : -173.2246, -104.9879, 30.87895, 67.90291 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> variables : 1
#> names : species
#> value : Arnica_ovata
BIEN_ranges_load_species("Arnica ovata")
#> class : SpatialPolygonsDataFrame
#> features : 1
#> extent : -173.2246, -104.9879, 30.87895, 67.90291 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs
#> variables : 1
#> names : species
#> value : Arnica_ovata
# Trait functions need species *without* underscores
BIEN_trait_species("Arnica_ovata")
#> data frame with 0 columns and 0 rows
tibble::as_tibble(BIEN_trait_species("Arnica ovata"))
#> # A tibble: 4 x 13
#> scrubbed_specie~ trait_name trait_value unit method latitude longitude
#> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl>
#> 1 Arnica ovata seed mass 1.357 mg data ~ NA NA
#> 2 Arnica ovata whole pla~ Herb <NA> Speci~ NA NA
#> 3 Arnica ovata seed mass 1.357 mg data ~ NA NA
#> 4 Arnica ovata whole pla~ Herb <NA> Speci~ NA NA
#> # ... with 6 more variables: elevation_m <int>, url_source <chr>,
#> # project_pi <chr>, project_pi_contact <chr>, access <chr>, id <dbl>
I've been trying to download a species list, then getting the traits for the list automatically. However, there is a naming inconsistency in species names between function that gets you the occurrence/ranges of species, and the functions that gets the trait data.
The former need the species name with an underscore, while the latter need the species name separated by a space:
Created on 2020-11-20 by the reprex package (v0.3.0)
Session info
``` r devtools::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 4.0.2 (2020-06-22) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate French_France.1252 #> ctype French_France.1252 #> tz Europe/Berlin #> date 2020-11-20 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> ape 5.4-1 2020-08-13 [1] CRAN (R 4.0.3) #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.3) #> BIEN * 1.2.4 2020-02-27 [1] CRAN (R 4.0.3) #> callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.3) #> class 7.3-17 2020-04-26 [2] CRAN (R 4.0.2) #> classInt 0.4-3 2020-04-07 [1] CRAN (R 4.0.3) #> cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.3) #> codetools 0.2-18 2020-11-04 [1] CRAN (R 4.0.3) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.3) #> DBI * 1.1.0 2019-12-15 [1] CRAN (R 4.0.3) #> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.3) #> devtools 2.3.2 2020-09-18 [1] CRAN (R 4.0.3) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3) #> doParallel 1.0.16 2020-10-16 [1] CRAN (R 4.0.3) #> dplyr 1.0.2 2020-08-18 [1] CRAN (R 4.0.3) #> e1071 1.7-4 2020-10-14 [1] CRAN (R 4.0.3) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.3) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.3) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.3) #> fasterize 1.0.3 2020-07-27 [1] CRAN (R 4.0.3) #> foreach 1.5.1 2020-10-15 [1] CRAN (R 4.0.3) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.3) #> generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.3) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.3) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.3) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.3) #> iterators 1.0.13 2020-10-15 [1] CRAN (R 4.0.3) #> KernSmooth 2.23-18 2020-10-29 [1] CRAN (R 4.0.3) #> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.3) #> lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.3) #> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.3) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.3) #> nlme 3.1-150 2020-10-24 [1] CRAN (R 4.0.3) #> pillar 1.4.7 2020-11-20 [1] CRAN (R 4.0.2) #> pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.3) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.3) #> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.3) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.3) #> processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.3) #> ps 1.4.0 2020-10-07 [1] CRAN (R 4.0.3) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.3) #> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.3) #> raster 3.3-13 2020-07-17 [1] CRAN (R 4.0.3) #> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.3) #> remotes 2.2.0 2020-07-21 [1] CRAN (R 4.0.3) #> rgdal 1.5-18 2020-10-13 [1] CRAN (R 4.0.3) #> rgeos 0.5-5 2020-09-07 [1] CRAN (R 4.0.3) #> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.3) #> rmarkdown 2.5 2020-10-21 [1] CRAN (R 4.0.3) #> RPostgreSQL * 0.6-2 2017-06-24 [1] CRAN (R 4.0.3) #> rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.0.2) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.3) #> sf 0.9-6 2020-09-13 [1] CRAN (R 4.0.3) #> sp 1.4-4 2020-10-07 [1] CRAN (R 4.0.3) #> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.3) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.3) #> testthat 3.0.0 2020-10-31 [1] CRAN (R 4.0.3) #> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.3) #> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.3) #> units 0.6-7 2020-06-13 [1] CRAN (R 4.0.3) #> usethis 1.6.3 2020-09-17 [1] CRAN (R 4.0.3) #> utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.3) #> vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.3) #> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.3) #> xfun 0.19 2020-10-30 [1] CRAN (R 4.0.3) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.3) #> #> [1] C:/Users/ke76dimu/R/win-library/4.0 #> [2] C:/Program Files/R/R-4.0.2/library ```