[med-svn] [r-cran-rredlist] 01/05: New upstream version 0.4.0

Andreas Tille tille at debian.org
Mon Oct 2 10:58:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-rredlist.

commit 7538321d955ab31d73b35f12292c4336ac09cdfd
Author: Andreas Tille <tille at debian.org>
Date:   Mon Oct 2 12:53:28 2017 +0200

    New upstream version 0.4.0
---
 DESCRIPTION                           | 12 +++---
 MD5                                   | 61 +++++++++++++++--------------
 NAMESPACE                             |  2 +
 NEWS.md                               | 23 +++++++++++
 R/rl_citation.R                       |  2 +-
 R/rl_growth_forms.R                   | 34 ++++++++++++++++
 R/rl_sp_category.R                    |  4 +-
 R/rl_sp_country.R                     |  3 +-
 R/rl_threats.R                        |  1 +
 R/rl_version.R                        |  2 +-
 R/rredlist-package.R                  | 29 ++++++++------
 README.md                             | 22 ++++++-----
 man/rl_citation.Rd                    |  3 +-
 man/rl_common_names.Rd                |  4 +-
 man/rl_countries.Rd                   |  4 +-
 man/rl_growth_forms.Rd                | 56 +++++++++++++++++++++++++++
 man/rl_habitats.Rd                    | 12 +++---
 man/rl_history.Rd                     | 12 +++---
 man/rl_measures.Rd                    | 12 +++---
 man/rl_narrative.Rd                   | 12 +++---
 man/rl_occ_country.Rd                 | 12 +++---
 man/rl_regions.Rd                     |  4 +-
 man/rl_search.Rd                      | 12 +++---
 man/rl_sp.Rd                          |  4 +-
 man/rl_sp_category.Rd                 |  8 ++--
 man/rl_sp_citation.Rd                 | 12 +++---
 man/rl_sp_count.Rd                    |  4 +-
 man/rl_sp_country.Rd                  |  7 ++--
 man/rl_synonyms.Rd                    |  4 +-
 man/rl_threats.Rd                     | 13 ++++---
 man/rl_version.Rd                     |  3 +-
 man/rredlist-package.Rd               | 22 +++++++----
 tests/testthat/test-rl_growth_forms.R | 73 +++++++++++++++++++++++++++++++++++
 33 files changed, 360 insertions(+), 128 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 000535d..f56c921 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -4,18 +4,18 @@ Title: 'IUCN' Red List Client
 Description: 'IUCN' Red List (<http://apiv3.iucnredlist.org/api/v3/docs>) client.
     The 'IUCN' Red List is a global list of threatened and endangered species.
     Functions cover all of the Red List 'API' routes. An 'API' key is required.
-Version: 0.3.0
+Version: 0.4.0
 Authors at R: c(person("Scott", "Chamberlain", role = c("aut", "cre"),
     email = "myrmecocystus at gmail.com"))
 License: MIT + file LICENSE
 URL: https://github.com/ropensci/rredlist
 BugReports: https://github.com/ropensci/rredlist/issues
-Imports: crul (>= 0.2.0), jsonlite (>= 1.1)
-Suggests: roxygen2 (>= 5.0.1), testthat, covr
-RoxygenNote: 5.0.1
+Imports: crul (>= 0.3.8), jsonlite (>= 1.1)
+Suggests: roxygen2 (>= 6.0.1), testthat
+RoxygenNote: 6.0.1
 NeedsCompilation: no
-Packaged: 2017-01-11 23:51:12 UTC; sacmac
+Packaged: 2017-08-25 22:51:08 UTC; sacmac
 Author: Scott Chamberlain [aut, cre]
 Maintainer: Scott Chamberlain <myrmecocystus at gmail.com>
 Repository: CRAN
-Date/Publication: 2017-01-12 00:56:40
+Date/Publication: 2017-08-26 06:12:39 UTC
diff --git a/MD5 b/MD5
index 747e31f..d5a532e 100644
--- a/MD5
+++ b/MD5
@@ -1,10 +1,11 @@
-cb1e39f6b3044eed690788c8e7d3cd60 *DESCRIPTION
+cd0e381706ec9f20be51ca9e6c80180d *DESCRIPTION
 c5af52351472a750055a760a8924ce71 *LICENSE
-ff723542b5c3070258f677b2f725713c *NAMESPACE
-2fd3a8e5d6f33f7abce7cc7603b876dd *NEWS.md
-ce32725fe606af64fe6052cbb0d1ecc1 *R/rl_citation.R
+0a4f03e553ba60b4a9fa8f38dd25cb51 *NAMESPACE
+cbf7e6c933a1463f9362f01bbb817022 *NEWS.md
+2fd417520f5e264cc5ce6054853d1ba9 *R/rl_citation.R
 4d03043dbdfb18f7df49d7b66fb012c2 *R/rl_common_names.R
 3e9ee7bbf9c366ef2eba84e3f43f490e *R/rl_countries.R
+b04ebb961f7af536ddff27d2df811b16 *R/rl_growth_forms.R
 385cccf373842340f4a06c221f8f6d9e *R/rl_habitats.R
 bca4e44fdaeb609d55c9344090bc0f79 *R/rl_history.R
 78329f449a6d8ce5df2650dbaac603fc *R/rl_measures.R
@@ -13,40 +14,42 @@ f03a75e3c552984146142c51294de1f1 *R/rl_narrative.R
 c92f5de0c1e924576b0d5e9dc5aadf1f *R/rl_regions.R
 5204716f15da7732fd8ee2081ab561f7 *R/rl_search.R
 f0f3d026aef0af0acc8fc7e250ca1919 *R/rl_sp.R
-dbf3fff38117305b4b2f45a5f90a26ad *R/rl_sp_category.R
+2863324b703907eccf2c2a2c31e76d65 *R/rl_sp_category.R
 5aeefc7b42f3f3696af5a0844aace09a *R/rl_sp_citation.R
 8931335e5885da2336a9dd7d29af6a05 *R/rl_sp_count.R
-f5f82ad24a26dfbfb647d6a5af6358db *R/rl_sp_country.R
+2bd94d22712421ed756a157f8240c4aa *R/rl_sp_country.R
 9e5f3741f4acb5037d5244e5b0a1993c *R/rl_synonyms.R
-663ea092a2172aec93f0b3bb9d37f872 *R/rl_threats.R
-a4d29a3516c6929f111d1c36983fad9f *R/rl_version.R
-ef02c86911621110451ea27fc26fda12 *R/rredlist-package.R
+4bee8205e89ba38fd20b051a7f88bbd7 *R/rl_threats.R
+b5597a5e79d52bb331bfb4d82ca4c7c0 *R/rl_version.R
+02f1015541815ff4fd0c628cb0a55956 *R/rredlist-package.R
 a0f098fb4d50eb2c8cf03456ad788ea8 *R/zzz.R
-0750e57e4470a4c3ffd799d82bb16a15 *README.md
-ede7821f1a8a457d414ea79654c90a8f *man/rl_citation.Rd
-6986e6cf34fadb9c374045cb2c2d0bf8 *man/rl_common_names.Rd
-22b2b24a2bbd9e5822bba442f2cb8e9d *man/rl_countries.Rd
-c79d6c1d19d71f653193d4da0b39617a *man/rl_habitats.Rd
-9a3a3b3156bf0efbdfca7b5c02853c3d *man/rl_history.Rd
-5a26ed325904e2f62cb85d0bd157672f *man/rl_measures.Rd
-a45c4eb3b852b7ca022d6eb7b5ca6ec0 *man/rl_narrative.Rd
-a1a3b7289bd808cc69486fe093aff6e0 *man/rl_occ_country.Rd
-b6a8944bb1cf6a584a6f631516e7276b *man/rl_regions.Rd
-5bb413b5e04f3f685c8dc1f8482423b3 *man/rl_search.Rd
-1bcdc04856545ff56f080245a9aa409e *man/rl_sp.Rd
-f3aba94d22bbd71771a833b3608135fd *man/rl_sp_category.Rd
-5c1cf39fe7a1ac4c9e857d77b28e006b *man/rl_sp_citation.Rd
-bac3a67f68bc627c6f122747e21e60cb *man/rl_sp_count.Rd
-bf2f67f965c52919e95ca02d700f2061 *man/rl_sp_country.Rd
-1a4dd8be89d363b2e4fb1a5a7690e5bb *man/rl_synonyms.Rd
-58c9e2f9babe9693aebc12aa0b64fb40 *man/rl_threats.Rd
-bdada92086ec57156b210a8d43371286 *man/rl_version.Rd
-ac481a4b0ea113e8ed2c7a12eabc2291 *man/rredlist-package.Rd
+a7f96e3a05f6fa5cca5248aba3c6d14a *README.md
+e53c7dfcb5e697dde659b754e32bda77 *man/rl_citation.Rd
+c85bde97557aa9d7ed77d5bf567d8402 *man/rl_common_names.Rd
+70de0810e3fa3e519838677324e28b91 *man/rl_countries.Rd
+34f2d53e73e29a0ddd164e6c0fbc0ebf *man/rl_growth_forms.Rd
+b8a0d59a6a30a39e84a46351a091383d *man/rl_habitats.Rd
+a86c04dc54efd9304a5c1567bb9610f7 *man/rl_history.Rd
+f7f5b16328855b3518f1e06b2d9bc0f4 *man/rl_measures.Rd
+5092fa6ab64f20aaec731dce011c491e *man/rl_narrative.Rd
+77a30ba259ea70bc44a5cdf3644aba3d *man/rl_occ_country.Rd
+5e8660098fb2ec2e4a075b01661706a4 *man/rl_regions.Rd
+acbb643aec65ca3eafe14039bdc9e2b4 *man/rl_search.Rd
+1296a34e51148683cced07aeb64c7187 *man/rl_sp.Rd
+5213d1a6fc5d647432a3a01c25429886 *man/rl_sp_category.Rd
+cbddeb716814c579117ecde8d2615b70 *man/rl_sp_citation.Rd
+b67392065d06218137cccab98f308532 *man/rl_sp_count.Rd
+cdf05635471b14bb05e286eb8290560b *man/rl_sp_country.Rd
+c9c5f10235e29899629dc1847eee6c23 *man/rl_synonyms.Rd
+23b536ca1234ad7eba2e66b66dddb8ec *man/rl_threats.Rd
+a318b5d467d59601faef1be0b5ad2ed6 *man/rl_version.Rd
+5938183b1f9aa95f3e125f6d35552c2a *man/rredlist-package.Rd
 d5da941c797771d510f5e8d756e73c76 *tests/test-all.R
 4deb56bf7c6d214fd61a249f690bc6bd *tests/testthat/test-fail-well.R
 74f99661ed270bc8be62cb31640d3233 *tests/testthat/test-rl_citation.R
 073723ef23fd7b9da35d5debc99c47bf *tests/testthat/test-rl_common_names.R
 2f5902b110cb8d7bad1e5ac8ade393e1 *tests/testthat/test-rl_countries.R
+fce63a71f981e8988d041bc4448e4e0a *tests/testthat/test-rl_growth_forms.R
 e725c2925af46e5957b209983fae6c13 *tests/testthat/test-rl_habitat.R
 e0f8497d8988f0ef158cd7ab03c659f9 *tests/testthat/test-rl_history.R
 40233433d18aa2e53b3ebeb58e50d08c *tests/testthat/test-rl_measures.R
diff --git a/NAMESPACE b/NAMESPACE
index e56e1a3..e8b5a26 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -5,6 +5,8 @@ export(rl_common_names)
 export(rl_common_names_)
 export(rl_countries)
 export(rl_countries_)
+export(rl_growth_forms)
+export(rl_growth_forms_)
 export(rl_habitats)
 export(rl_habitats_)
 export(rl_history)
diff --git a/NEWS.md b/NEWS.md
index 324b75f..e2a62ca 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,26 @@
+rredlist 0.4.0
+==============
+
+### NEW FEATURES
+
+* Gains new functions `rl_growth_forms()` and `rl_growth_forms_()`. added 
+tests for them as well (#20) thanks @stevenpbachman
+
+### MINOR IMPROVEMENTS
+
+* Now using markdown documentation (#22)
+* Fixed many man files which for `region` parameter described 
+requiring a taxonomic name - fixed to describe accurately. Also 
+improved docs in general (#21)
+* Added the options for `category` parameter in `rl_sp_category()` function 
+* Added in docs for `rl_sp_country` how to get acceptable country codes to 
+pass to `country` parameter
+* Added to package level manual file `?rredlist-package` a note from the 
+IUCN Redlist API documentation about that they suggest using taxonomic 
+names instead of IDs because IDs can change through time
+
+
+
 rredlist 0.3.0
 ==============
 
diff --git a/R/rl_citation.R b/R/rl_citation.R
index 405342e..bd38ec2 100644
--- a/R/rl_citation.R
+++ b/R/rl_citation.R
@@ -1,7 +1,7 @@
 #' Get the citation Red List API version
 #'
 #' @export
-#' @param ... Curl options passed to \code{\link[crul]{HttpClient}}
+#' @param ... Curl options passed to [crul::HttpClient()]
 #' @return API citation as character string
 #' @examples \dontrun{
 #' rl_citation()
diff --git a/R/rl_growth_forms.R b/R/rl_growth_forms.R
new file mode 100644
index 0000000..d4b9b8c
--- /dev/null
+++ b/R/rl_growth_forms.R
@@ -0,0 +1,34 @@
+#' Get plant species growth forms by taxon name, IUCN id, and region
+#'
+#' @export
+#' @template commonargs
+#' @template all
+#' @template info
+#' @examples \dontrun{
+#' rl_growth_forms('Quercus robur')
+#' rl_growth_forms('Quercus robur', region = 'europe')
+#' rl_growth_forms(id = 63532)
+#' rl_growth_forms(id = 63532, region = 'europe')
+#'
+#' rl_growth_forms('Mucuna bracteata')
+#' rl_growth_forms('Abarema villifera')
+#' rl_growth_forms('Adansonia perrieri')
+#' rl_growth_forms('Adenostemma harlingii')
+#'
+#' rl_growth_forms_('Quercus robur')
+#' rl_growth_forms_(id = 63532, region = 'europe')
+#' }
+rl_growth_forms <- function(name = NULL, id = NULL, region = NULL,
+                        key = NULL, parse = TRUE, ...) {
+  assert_is(parse, 'logical')
+  rl_parse(rl_growth_forms_(name, id, region, key, ...), parse)
+}
+
+#' @export
+#' @rdname rl_growth_forms
+rl_growth_forms_ <- function(name = NULL, id = NULL, region = NULL,
+                         key = NULL, ...) {
+  assert_is(key, 'character')
+  rr_GET(nir("growth_forms/species/name", "growth_forms/species/id",
+             name, id, region), key, ...)
+}
diff --git a/R/rl_sp_category.R b/R/rl_sp_category.R
index 5239635..9515fc9 100644
--- a/R/rl_sp_category.R
+++ b/R/rl_sp_category.R
@@ -1,10 +1,12 @@
 #' Get species by category
 #'
 #' @export
-#' @param category (character) 2 letter category code
+#' @param category (character) A two-letter category code. One of
+#' "DD", "LC", "NT", "VU", "EN", "CR", "EW", "EX", "LRlc", "LRnt", "LRcd"
 #' @template all
 #' @examples \dontrun{
 #' rl_sp_category('VU')
+#' rl_sp_category('LRlc')
 #' rl_sp_category('EN')
 #' rl_sp_category('EX')
 #' rl_sp_category('EX', parse = FALSE)
diff --git a/R/rl_sp_country.R b/R/rl_sp_country.R
index 0ac18e5..7fff250 100644
--- a/R/rl_sp_country.R
+++ b/R/rl_sp_country.R
@@ -1,7 +1,8 @@
 #' Get species by country
 #'
 #' @export
-#' @param country (character) Country 2 letter character code
+#' @param country (character) A two-letter country code. See `isocode` column
+#' in result of [rl_countries()] request for country codes.
 #' @template all
 #' @template info
 #' @examples \dontrun{
diff --git a/R/rl_threats.R b/R/rl_threats.R
index ba2fe96..b19d2ab 100644
--- a/R/rl_threats.R
+++ b/R/rl_threats.R
@@ -9,6 +9,7 @@
 #' rl_threats('Fratercula arctica', region = 'europe')
 #' rl_threats(id = 12392)
 #' rl_threats(id = 22694927, region = 'europe')
+#' rl_threats(name = 'Abies numidica')
 #' rl_threats_('Fratercula arctica')
 #'
 #' rl_threats(id = 62290750)
diff --git a/R/rl_version.R b/R/rl_version.R
index d9c7ea7..2be2881 100644
--- a/R/rl_version.R
+++ b/R/rl_version.R
@@ -1,7 +1,7 @@
 #' Get the Red List API version
 #'
 #' @export
-#' @param ... Curl options passed to \code{\link[crul]{HttpClient}}
+#' @param ... Curl options passed to [crul::HttpClient()]
 #' @return API version as character string
 #' @examples \dontrun{
 #' rl_version()
diff --git a/R/rredlist-package.R b/R/rredlist-package.R
index 7acd9e4..d6c248a 100644
--- a/R/rredlist-package.R
+++ b/R/rredlist-package.R
@@ -1,34 +1,41 @@
 #' rredlist - IUCN Red List Client
 #'
+#' @section Taxonomic Names vs. IUCN IDs:
+#' From the documentation (quoting): "It is advisable wherever possible to use
+#' the taxon name (species name) to make your API calls, rather than using IDs.
+#' IDs are not immovable are expected to be used mainly by organisations
+#' that work closely with the IUCN Red List."
+#'
 #' @section Authentication:
 #' IUCN requires you to get your own API key, an alphanumeric string that you
 #' need to send in every request. Get it at
-#' \url{http://apiv3.iucnredlist.org/api/v3/token}.
+#' <http://apiv3.iucnredlist.org/api/v3/token>
 #' Keep this key private. You can pass the key in to each function via the
-#' \code{key} parameter, but it's better to store the key either as a
-#' environment variable (\code{IUCN_REDLIST_KEY}) or an R option
-#' (\code{iucn_redlist_key}) - we suggest using the former option.
+#' `key` parameter, but it's better to store the key either as a
+#' environment variable (`IUCN_REDLIST_KEY`) or an R option
+#' (`iucn_redlist_key`) - we suggest using the former option.
 #'
 #' @section High vs. Low level package APIs:
-#' \strong{High level API}
+#' **High level API**
 #' High level functions do the HTTP request and parse data to a data.frame for
 #' ease of downstream use. The high level functions have no underscore on
-#' the end of the function name, e.g., \code{\link{rl_search}}
+#' the end of the function name, e.g., [rl_search()]
 #'
-#' \strong{Low level API}
+#' **Low level API**
 #' The parsing to data.frame in the high level API does take extra time.
 #' The low level API only does the HTTP request, and gives back JSON without
 #' doing any more parsing. The low level functions DO have an underscore on
-#' the end of the function name, e.g., \code{\link{rl_search_}}
+#' the end of the function name, e.g., [rl_search_()]
 #'
 #' @section No Spatial:
 #' This package does not include support for the spatial API, described at
-#' \url{http://apiv3.iucnredlist.org/spatial}
+#' <http://apiv3.iucnredlist.org/spatial>
 #'
 #' @section Citing the Red List API:
 #' The citation is
-#' \code{IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4 <www.iucnredlist.org>}.
-#' You can get this programatically via \code{\link{rl_citation}}
+#' `IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4
+#' <www.iucnredlist.org>`
+#' You can get this programatically via [rl_citation()]
 #'
 #' @section Rate limiting:
 #' From the IUCN folks: Too many frequent calls, or too many calls per day
diff --git a/README.md b/README.md
index 7e34e04..b4a6d9e 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@ use the function `rl_citation()`
 
 ```r
 rl_citation()
-#> [1] "IUCN 2015. IUCN Red List of Threatened Species. Version 2016-3 <www.iucnredlist.org>"
+#> [1] "IUCN 2015. IUCN Red List of Threatened Species. Version 2017-1 <www.iucnredlist.org>"
 ```
 
 
@@ -86,13 +86,15 @@ rl_search('Fratercula arctica')
 #>    taxonid    scientific_name  kingdom   phylum class           order
 #> 1 22694927 Fratercula arctica ANIMALIA CHORDATA  AVES CHARADRIIFORMES
 #>    family      genus main_common_name        authority published_year
-#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2016
+#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2017
 #>   category criteria marine_system freshwater_system terrestrial_system
 #> 1       VU  A4abcde          TRUE             FALSE               TRUE
 #>                 assessor                 reviewer aoo_km2  eoo_km2
 #> 1 BirdLife International Butchart, S. & Symes, A.      NA 20800000
-#>   errata_flag errata_reason
-#> 1       FALSE            NA
+#>   elevation_upper elevation_lower depth_upper depth_lower errata_flag
+#> 1              NA              NA          NA          NA       FALSE
+#>   errata_reason
+#> 1            NA
 ```
 
 Likely a bit faster is to parse to a list only, and not take the extra data.frame parsing time
@@ -121,7 +123,7 @@ only does the HTTP request, and gives back JSON without doing any more parsing
 
 ```r
 rl_search_('Fratercula arctica')
-#> [1] "{\"name\":\"Fratercula arctica\",\"result\":[{\"taxonid\":22694927,\"scientific_name\":\"Fratercula arctica\",\"kingdom\":\"ANIMALIA\",\"phylum\":\"CHORDATA\",\"class\":\"AVES\",\"order\":\"CHARADRIIFORMES\",\"family\":\"ALCIDAE\",\"genus\":\"Fratercula\",\"main_common_name\":\"Atlantic Puffin\",\"authority\":\"(Linnaeus, 1758)\",\"published_year\":2016,\"category\":\"VU\",\"criteria\":\"A4abcde\",\"marine_system\":true,\"freshwater_system\":false,\"terrestrial_system\":true,\"as [...]
+#> [1] "{\"name\":\"Fratercula arctica\",\"result\":[{\"taxonid\":22694927,\"scientific_name\":\"Fratercula arctica\",\"kingdom\":\"ANIMALIA\",\"phylum\":\"CHORDATA\",\"class\":\"AVES\",\"order\":\"CHARADRIIFORMES\",\"family\":\"ALCIDAE\",\"genus\":\"Fratercula\",\"main_common_name\":\"Atlantic Puffin\",\"authority\":\"(Linnaeus, 1758)\",\"published_year\":2017,\"category\":\"VU\",\"criteria\":\"A4abcde\",\"marine_system\":true,\"freshwater_system\":false,\"terrestrial_system\":true,\"as [...]
 ```
 
 To consume this JSON, you can use `jsonlite`
@@ -137,13 +139,15 @@ jsonlite::fromJSON(rl_search_('Fratercula arctica'))
 #>    taxonid    scientific_name  kingdom   phylum class           order
 #> 1 22694927 Fratercula arctica ANIMALIA CHORDATA  AVES CHARADRIIFORMES
 #>    family      genus main_common_name        authority published_year
-#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2016
+#> 1 ALCIDAE Fratercula  Atlantic Puffin (Linnaeus, 1758)           2017
 #>   category criteria marine_system freshwater_system terrestrial_system
 #> 1       VU  A4abcde          TRUE             FALSE               TRUE
 #>                 assessor                 reviewer aoo_km2  eoo_km2
 #> 1 BirdLife International Butchart, S. & Symes, A.      NA 20800000
-#>   errata_flag errata_reason
-#> 1       FALSE            NA
+#>   elevation_upper elevation_lower depth_upper depth_lower errata_flag
+#> 1              NA              NA          NA          NA       FALSE
+#>   errata_reason
+#> 1            NA
 ```
 
 Or other tools, e.g., `jq` via the `jqr` R client
@@ -167,7 +171,7 @@ rl_search_('Fratercula arctica') %>% dot()
 #>             "genus": "Fratercula",
 #>             "main_common_name": "Atlantic Puffin",
 #>             "authority": "(Linnaeus, 1758)",
-#>             "published_year": 2016,
+#>             "published_year": 2017,
 #>             "category": "VU",
 #>             "criteria": "A4abcde",
 #>             "marine_system": true,
diff --git a/man/rl_citation.Rd b/man/rl_citation.Rd
index 7ab9081..86b3f8d 100644
--- a/man/rl_citation.Rd
+++ b/man/rl_citation.Rd
@@ -7,7 +7,7 @@
 rl_citation(...)
 }
 \arguments{
-\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+\item{...}{Curl options passed to \code{\link[crul:HttpClient]{crul::HttpClient()}}}
 }
 \value{
 API citation as character string
@@ -20,4 +20,3 @@ Get the citation Red List API version
 rl_citation()
 }
 }
-
diff --git a/man/rl_common_names.Rd b/man/rl_common_names.Rd
index a633395..4dbdfd3 100644
--- a/man/rl_common_names.Rd
+++ b/man/rl_common_names.Rd
@@ -12,7 +12,8 @@ rl_common_names_(name = NULL, key = NULL, ...)
 \arguments{
 \item{name}{(character) Binomial taxonomic name}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -36,4 +37,3 @@ rl_common_names_('Loxodonta africana')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_countries.Rd b/man/rl_countries.Rd
index 0b46f4e..bd293eb 100644
--- a/man/rl_countries.Rd
+++ b/man/rl_countries.Rd
@@ -10,7 +10,8 @@ rl_countries(key = NULL, parse = TRUE, ...)
 rl_countries_(key = NULL, ...)
 }
 \arguments{
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -34,4 +35,3 @@ rl_countries_()
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_growth_forms.Rd b/man/rl_growth_forms.Rd
new file mode 100644
index 0000000..d8a5358
--- /dev/null
+++ b/man/rl_growth_forms.Rd
@@ -0,0 +1,56 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/rl_growth_forms.R
+\name{rl_growth_forms}
+\alias{rl_growth_forms}
+\alias{rl_growth_forms_}
+\title{Get plant species growth forms by taxon name, IUCN id, and region}
+\usage{
+rl_growth_forms(name = NULL, id = NULL, region = NULL, key = NULL,
+  parse = TRUE, ...)
+
+rl_growth_forms_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
+}
+\arguments{
+\item{name}{(character) A taxonomic name}
+
+\item{id}{(character) An IUCN identifier}
+
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
+
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
+
+\item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
+data.frame (\code{TRUE}). Default: \code{TRUE}}
+
+\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+}
+\value{
+A list, with the data in the \code{result} slot, unless using
+a function with a trailing underscore, in which case json as character
+string is returned.
+}
+\description{
+Get plant species growth forms by taxon name, IUCN id, and region
+}
+\examples{
+\dontrun{
+rl_growth_forms('Quercus robur')
+rl_growth_forms('Quercus robur', region = 'europe')
+rl_growth_forms(id = 63532)
+rl_growth_forms(id = 63532, region = 'europe')
+
+rl_growth_forms('Mucuna bracteata')
+rl_growth_forms('Abarema villifera')
+rl_growth_forms('Adansonia perrieri')
+rl_growth_forms('Adenostemma harlingii')
+
+rl_growth_forms_('Quercus robur')
+rl_growth_forms_(id = 63532, region = 'europe')
+}
+}
+\references{
+API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
+}
diff --git a/man/rl_habitats.Rd b/man/rl_habitats.Rd
index f0422dc..67ea73a 100644
--- a/man/rl_habitats.Rd
+++ b/man/rl_habitats.Rd
@@ -14,13 +14,16 @@ rl_habitats_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 rl_history_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -49,4 +52,3 @@ rl_habitats_(id = 12392)
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_history.Rd b/man/rl_history.Rd
index 57acacd..1a95b5c 100644
--- a/man/rl_history.Rd
+++ b/man/rl_history.Rd
@@ -8,13 +8,16 @@ rl_history(name = NULL, id = NULL, region = NULL, key = NULL,
   parse = TRUE, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -43,4 +46,3 @@ rl_history_(id = 12392)
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_measures.Rd b/man/rl_measures.Rd
index ca3c855..8c86d28 100644
--- a/man/rl_measures.Rd
+++ b/man/rl_measures.Rd
@@ -11,13 +11,16 @@ rl_measures(name = NULL, id = NULL, region = NULL, key = NULL,
 rl_measures_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -46,4 +49,3 @@ rl_measures_(id = 22694927, region = 'europe')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_narrative.Rd b/man/rl_narrative.Rd
index b84ef83..5c14427 100644
--- a/man/rl_narrative.Rd
+++ b/man/rl_narrative.Rd
@@ -11,13 +11,16 @@ rl_narrative(name = NULL, id = NULL, region = NULL, key = NULL,
 rl_narrative_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -46,4 +49,3 @@ rl_narrative_('Fratercula arctica', region = 'europe')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_occ_country.Rd b/man/rl_occ_country.Rd
index cddfaff..af364a6 100644
--- a/man/rl_occ_country.Rd
+++ b/man/rl_occ_country.Rd
@@ -8,13 +8,16 @@ rl_occ_country(name = NULL, id = NULL, region = NULL, key = NULL,
   parse = TRUE, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -44,4 +47,3 @@ rl_occ_country_('Fratercula arctica', region = 'europe')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_regions.Rd b/man/rl_regions.Rd
index d9b59cb..5a8e810 100644
--- a/man/rl_regions.Rd
+++ b/man/rl_regions.Rd
@@ -10,7 +10,8 @@ rl_regions(key = NULL, parse = TRUE, ...)
 rl_regions_(key = NULL, ...)
 }
 \arguments{
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -35,4 +36,3 @@ rl_regions_()
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_search.Rd b/man/rl_search.Rd
index 271120f..e114972 100644
--- a/man/rl_search.Rd
+++ b/man/rl_search.Rd
@@ -14,13 +14,16 @@ rl_search(name = NULL, id = NULL, region = NULL, key = NULL,
 rl_search_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
 
@@ -50,4 +53,3 @@ rl_search_('Fratercula arctica', region = 'europe')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_sp.Rd b/man/rl_sp.Rd
index 6dd57f2..690eca7 100644
--- a/man/rl_sp.Rd
+++ b/man/rl_sp.Rd
@@ -12,7 +12,8 @@ rl_sp_(page, key = NULL, ...)
 \arguments{
 \item{page}{(integer/numeric) Page to get. Default: 1}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -27,4 +28,3 @@ Get species
 rl_sp(page = 3)
 }
 }
-
diff --git a/man/rl_sp_category.Rd b/man/rl_sp_category.Rd
index 3169081..3142424 100644
--- a/man/rl_sp_category.Rd
+++ b/man/rl_sp_category.Rd
@@ -10,9 +10,11 @@ rl_sp_category(category, key = NULL, parse = TRUE, ...)
 rl_sp_category_(category, key = NULL, parse = TRUE, ...)
 }
 \arguments{
-\item{category}{(character) 2 letter category code}
+\item{category}{(character) A two-letter category code. One of
+"DD", "LC", "NT", "VU", "EN", "CR", "EW", "EX", "LRlc", "LRnt", "LRcd"}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -25,10 +27,10 @@ Get species by category
 \examples{
 \dontrun{
 rl_sp_category('VU')
+rl_sp_category('LRlc')
 rl_sp_category('EN')
 rl_sp_category('EX')
 rl_sp_category('EX', parse = FALSE)
 rl_sp_category_('EX')
 }
 }
-
diff --git a/man/rl_sp_citation.Rd b/man/rl_sp_citation.Rd
index a6b32a8..f1a0ba5 100644
--- a/man/rl_sp_citation.Rd
+++ b/man/rl_sp_citation.Rd
@@ -11,13 +11,16 @@ rl_sp_citation(name = NULL, id = NULL, region = NULL, key = NULL,
 rl_sp_citation_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -46,4 +49,3 @@ rl_sp_citation_(id = 2467, region = 'europe')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_sp_count.Rd b/man/rl_sp_count.Rd
index 7f01858..919c71f 100644
--- a/man/rl_sp_count.Rd
+++ b/man/rl_sp_count.Rd
@@ -10,7 +10,8 @@ rl_sp_count(key = NULL, parse = TRUE, ...)
 rl_sp_count_(key = NULL, ...)
 }
 \arguments{
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -34,4 +35,3 @@ rl_sp_count_()
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_sp_country.Rd b/man/rl_sp_country.Rd
index e0a194a..3f419e0 100644
--- a/man/rl_sp_country.Rd
+++ b/man/rl_sp_country.Rd
@@ -10,9 +10,11 @@ rl_sp_country(country, key = NULL, parse = TRUE, ...)
 rl_sp_country_(country, key = NULL, ...)
 }
 \arguments{
-\item{country}{(character) Country 2 letter character code}
+\item{country}{(character) A two-letter country code. See \code{isocode} column
+in result of \code{\link[=rl_countries]{rl_countries()}} request for country codes.}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -44,4 +46,3 @@ res <- rl_sp_country('NZ', verbose = TRUE)
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_synonyms.Rd b/man/rl_synonyms.Rd
index 5c7515e..de6a736 100644
--- a/man/rl_synonyms.Rd
+++ b/man/rl_synonyms.Rd
@@ -12,7 +12,8 @@ rl_synonyms_(name = NULL, key = NULL, ...)
 \arguments{
 \item{name}{(character) Binomial taxonomic name}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -37,4 +38,3 @@ rl_synonyms_('Loxodonta africana')
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_threats.Rd b/man/rl_threats.Rd
index 68a15ac..832c35c 100644
--- a/man/rl_threats.Rd
+++ b/man/rl_threats.Rd
@@ -11,13 +11,16 @@ rl_threats(name = NULL, id = NULL, region = NULL, key = NULL,
 rl_threats_(name = NULL, id = NULL, region = NULL, key = NULL, ...)
 }
 \arguments{
-\item{name}{(character) Binomial taxonomic name}
+\item{name}{(character) A taxonomic name}
 
-\item{id}{(character) IUCN id}
+\item{id}{(character) An IUCN identifier}
 
-\item{region}{(character) Binomial taxonomic name}
+\item{region}{(character) A region name, see \code{\link{rl_regions}} for
+acceptable region identifiers (use the entries in the \code{identifier}
+column)}
 
-\item{key}{A IUCN API token}
+\item{key}{A IUCN API token. See
+\url{http://apiv3.iucnredlist.org/api/v3/token} to get a token}
 
 \item{parse}{(logical) Whether to parse to list (\code{FALSE}) or
 data.frame (\code{TRUE}). Default: \code{TRUE}}
@@ -38,6 +41,7 @@ rl_threats('Fratercula arctica')
 rl_threats('Fratercula arctica', region = 'europe')
 rl_threats(id = 12392)
 rl_threats(id = 22694927, region = 'europe')
+rl_threats(name = 'Abies numidica')
 rl_threats_('Fratercula arctica')
 
 rl_threats(id = 62290750)
@@ -46,4 +50,3 @@ rl_threats(id = 62290750)
 \references{
 API docs at \url{http://apiv3.iucnredlist.org/api/v3/docs}
 }
-
diff --git a/man/rl_version.Rd b/man/rl_version.Rd
index 3891727..002a40f 100644
--- a/man/rl_version.Rd
+++ b/man/rl_version.Rd
@@ -7,7 +7,7 @@
 rl_version(...)
 }
 \arguments{
-\item{...}{Curl options passed to \code{\link[crul]{HttpClient}}}
+\item{...}{Curl options passed to \code{\link[crul:HttpClient]{crul::HttpClient()}}}
 }
 \value{
 API version as character string
@@ -20,4 +20,3 @@ Get the Red List API version
 rl_version()
 }
 }
-
diff --git a/man/rredlist-package.Rd b/man/rredlist-package.Rd
index 178303b..ba56d7c 100644
--- a/man/rredlist-package.Rd
+++ b/man/rredlist-package.Rd
@@ -2,17 +2,25 @@
 % Please edit documentation in R/rredlist-package.R
 \docType{package}
 \name{rredlist-package}
-\alias{rredlist}
 \alias{rredlist-package}
+\alias{rredlist}
 \title{rredlist - IUCN Red List Client}
 \description{
 rredlist - IUCN Red List Client
 }
+\section{Taxonomic Names vs. IUCN IDs}{
+
+From the documentation (quoting): "It is advisable wherever possible to use
+the taxon name (species name) to make your API calls, rather than using IDs.
+IDs are not immovable are expected to be used mainly by organisations
+that work closely with the IUCN Red List."
+}
+
 \section{Authentication}{
 
 IUCN requires you to get your own API key, an alphanumeric string that you
 need to send in every request. Get it at
-\url{http://apiv3.iucnredlist.org/api/v3/token}.
+\url{http://apiv3.iucnredlist.org/api/v3/token}
 Keep this key private. You can pass the key in to each function via the
 \code{key} parameter, but it's better to store the key either as a
 environment variable (\code{IUCN_REDLIST_KEY}) or an R option
@@ -24,13 +32,13 @@ environment variable (\code{IUCN_REDLIST_KEY}) or an R option
 \strong{High level API}
 High level functions do the HTTP request and parse data to a data.frame for
 ease of downstream use. The high level functions have no underscore on
-the end of the function name, e.g., \code{\link{rl_search}}
+the end of the function name, e.g., \code{\link[=rl_search]{rl_search()}}
 
 \strong{Low level API}
 The parsing to data.frame in the high level API does take extra time.
 The low level API only does the HTTP request, and gives back JSON without
 doing any more parsing. The low level functions DO have an underscore on
-the end of the function name, e.g., \code{\link{rl_search_}}
+the end of the function name, e.g., \code{\link[=rl_search_]{rl_search_()}}
 }
 
 \section{No Spatial}{
@@ -42,8 +50,8 @@ This package does not include support for the spatial API, described at
 \section{Citing the Red List API}{
 
 The citation is
-\code{IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4 <www.iucnredlist.org>}.
-You can get this programatically via \code{\link{rl_citation}}
+\code{IUCN 2015. IUCN Red List of Threatened Species. Version 2015-4 <www.iucnredlist.org>}
+You can get this programatically via \code{\link[=rl_citation]{rl_citation()}}
 }
 
 \section{Rate limiting}{
@@ -54,8 +62,8 @@ Red List Unit asked that you contact them, as there might be better options.
 They suggest a 2-second delay between your calls if you plan to make a
 lot of calls.
 }
+
 \author{
 Scott Chamberlain \email{myrmecocystus at gmail.com}
 }
 \keyword{package}
-
diff --git a/tests/testthat/test-rl_growth_forms.R b/tests/testthat/test-rl_growth_forms.R
new file mode 100644
index 0000000..4b2586e
--- /dev/null
+++ b/tests/testthat/test-rl_growth_forms.R
@@ -0,0 +1,73 @@
+context("rl_growth_forms functions")
+
+test_that("high level works - parsing", {
+  skip_on_cran()
+
+  aa <- rl_growth_forms('Quercus robur')
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "data.frame")
+  expect_named(aa$result, "name")
+})
+
+test_that("high level works - not parsing", {
+  skip_on_cran()
+
+  aa <- rl_growth_forms('Quercus robur', parse = FALSE)
+
+  expect_is(aa, "list")
+  expect_named(aa, c("name", "result"))
+  expect_is(aa$name, "character")
+  expect_is(aa$result, "list")
+  expect_named(aa$result[[1]], "name")
+})
+
+test_that("low level works", {
+  skip_on_cran()
+
+  library("jsonlite")
+
+  aa <- rl_growth_forms_('Mucuna bracteata')
+  aajson <- jsonlite::fromJSON(aa)
+
+  expect_is(aa, "character")
+  expect_is(aajson, "list")
+  expect_named(aajson, c("name", "result"))
+})
+
+test_that("no results", {
+  skip_on_cran()
+
+  aa <- rl_growth_forms('Mucuna asdfadf')
+
+  expect_is(aa, "list")
+  expect_is(aa$result, "list")
+  expect_equal(length(aa$result), 0)
+})
+
+test_that("fails well", {
+  skip_on_cran()
+
+  expect_error(rl_growth_forms(5), "name must be of class character")
+  expect_error(rl_growth_forms(list()), "name must be of class character")
+
+  expect_error(rl_growth_forms(id = "adsfds"), "id must be of class integer, numeric")
+  expect_error(rl_growth_forms(id = list()), "id must be of class integer, numeric")
+
+  expect_error(rl_growth_forms("ad", region = 5), "region must be of class character")
+  expect_error(rl_growth_forms("ad", region = list()), "region must be of class character")
+
+  expect_error(rl_growth_forms(key = 5), "key must be of class character")
+  expect_error(rl_growth_forms(key = matrix()), "key must be of class character")
+
+  expect_error(rl_growth_forms(parse = 5), "parse must be of class logical")
+  expect_error(rl_growth_forms(parse = matrix()), "parse must be of class logical")
+
+  # lengths
+  expect_error(rl_growth_forms(letters[1:2]), "name must be length 1")
+  expect_error(rl_growth_forms(id = 1:2), "id must be length 1")
+  expect_error(rl_growth_forms(letters[1], region = letters[1:2]), "region must be length 1")
+})
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-rredlist.git



More information about the debian-med-commit mailing list