kewr
Meant to make accessing data from one of Royal Botanic Gardenn Kew easier and to provide a consistent interface their public APIs.
https://github.com/barnabywalker/kewr
Category: Biosphere
Sub Category: Plants and Vegetation
Keywords
package r
Last synced: about 15 hours ago
JSON representation
Repository metadata
R Package to Access Kew Data APIs
- Host: GitHub
- URL: https://github.com/barnabywalker/kewr
- Owner: barnabywalker
- License: other
- Created: 2020-11-11T14:44:21.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-30T11:32:44.000Z (over 3 years ago)
- Last Synced: 2026-01-12T23:33:57.632Z (14 days ago)
- Topics: package, r
- Language: R
- Homepage: https://barnabywalker.github.io/kewr/
- Size: 2.06 MB
- Stars: 20
- Watchers: 3
- Forks: 0
- Open Issues: 5
- Releases: 0
https://github.com/barnabywalker/kewr/blob/main/
# kewr
[](https://github.com/barnabywalker/kewr/actions)
An R package to access data from RGB Kew’s APIs.
## Overview
kewr is meant to make accessing data from one of RGB Kew easier and to
provide a consistent interface their public APIs.
This package should cover:
- [x] [World Checklist of Vascular
Plants](https://wcvp.science.kew.org/)
- [x] [Plants of the World Online](http://powo.science.kew.org/)
- [x] [International Plant Names Index](https://www.ipni.org/)
- [x] [Kew Names Matching Service](http://namematch.science.kew.org/)
- [x] [Kew’s Tree of Life](https://treeoflife.kew.org)
- [x] [Kew Reconciliation
Service](http://data1.kew.org/reconciliation/about/IpniName)
New sources will be added as they come up.
## Installation
kewr is not on CRAN yet but you can install the latest development
version from GitHub:
``` r
# install.packages("devtools")
devtools::install_github("barnabywalker/kewr")
```
## Usage
Functions in this package all start with a prefix specifying what action
you want to perform and a suffix referring to the resource.
Four of the resources (POWO, WCVP, IPNI, and ToL) are databases storing
flora, taxonomic, nomenclatural, or genetic information. These three
resources all have a `search_*` and `lookup_*`.
### Retrieving records
The `lookup_` functions can be used to retrieve a particular record by
its unique IPNI ID:
``` r
lookup_powo("320035-2")
lookup_wcvp("320035-2")
lookup_ipni("320035-2")
```
IPNI contains records for authors and publications, which can also be
retrieved using the `lookup_ipni` function:
``` r
lookup_ipni("20885-1", type="author")
lookup_ipni("987-2", type="publication")
```
The ToL uses its own ID system. These IDs can be found by first
searching the database.
``` r
lookup_tol("2717")
```
### Searching databases
All four of these databases can be searched as well:
``` r
search_powo("Poa annua")
search_wcvp("Poa annua")
search_ipni("Poa annua")
search_tol("Poa annua")
```
And all, except the ToL, use filters and keywords for more advanced
searches:
``` r
search_powo(list(genus="Poa", distribution="Madagascar"),
filters=c("accepted", "species"))
search_wcvp(list(genus="Poa"), filters=c("accepted", "species"))
search_ipni(list(genus="Poa", published=1920),
filters=c("species"))
```
The number of search results returned are determined by the `limit`
keyword:
``` r
search_powo(list(genus="Poa"), limit=20)
search_wcvp(list(genus="Poa"), limit=20)
search_ipni(list(genus="Poa"), limit=20)
search_tol("Poa", limit=20)
```
The next page for a set of search results can be requested using the
`request_next` function:
``` r
results <- search_powo(list(genus="Poa"))
request_next(results)
```
### Loading data from ToL
Tree and gene data can be loaded directly from ToL into R.
For instance, you can load the whole Tree of Life.
``` r
load_tol()
```
Or a gene tree for a particular gene.
``` r
gene_info <- lookup_tol("51", type="gene")
load_tol(gene_info$tree_file_url)
```
Or a FASTA file for a specimen.
``` r
specimen_info <- lookup_tol("1296")
load_tol(specimen_info$fasta_file_url)
```
### Downloading from the ToL
The corresponding files can also be downloaded for use later or in other
programmes.
``` r
specimen_info <- lookup_tol("1296")
download_tol(specimen_info$fasta_file_url)
```
### Downloading the WCVP
The whole of WCVP can be download to a directory using:
``` r
download_wcvp()
```
### Matching names
The KNMS resource is only used for matching names to records in
POWO/WCVP:
``` r
match_knms(c("Poa annua", "Magnolia grandifolia", "Bulbophyllum sp."))
```
Single names can also be matched to IPNI using the KRS resources.
``` r
match_krs("Poa annua")
```
KRS is slower for matching many names, as a request needs to be made for
each one. But it has the advantage of allowing more complex matching:
``` r
match_krs(list(genus="Solanum", species="sanchez-vegae", author="S.Knapp"))
```
### Tidying results
Each function in this package returns an object that stores the original
response as well as the content of the response parsed into a list. This
is to give the user as much flexibility as possible and to make
debugging things a bit easier.
But this can be hard to use, so all the results objects can be tidied as
a `tibble`:
``` r
results <- search_powo("Poa annua")
tidy(results)
```
## Citing
You can get information about how to cite `kewr` by using:
``` r
citation("kewr")
```
You can also get the citation to use for each data service using the
different results objects:
r <- search_wcvp("Poa")
kew_citation(r)
Owner metadata
- Name:
- Login: barnabywalker
- Email:
- Kind: user
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/6917951?v=4
- Repositories: 5
- Last ynced at: 2023-03-08T22:05:12.973Z
- Profile URL: https://github.com/barnabywalker
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers metadata
Last synced: 9 days ago
Total Commits: 108
Total Committers: 1
Avg Commits per committer: 108.0
Development Distribution Score (DDS): 0.0
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| barnabywalker | b****8@g****m | 108 |
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 23
Total pull requests: 39
Average time to close issues: 2 months
Average time to close pull requests: 4 minutes
Total issue authors: 6
Total pull request authors: 1
Average comments per issue: 0.39
Average comments per pull request: 0.03
Merged pull request: 38
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- barnabywalker (18)
- MjGSob01 (1)
- jgomezd (1)
- pfrombris (1)
- stevespages (1)
- sagesteppe (1)
Top Pull Request Authors
- barnabywalker (39)
Top Issue Labels
- enhancement (15)
- documentation (3)
Top Pull Request Labels
Dependencies
- R >= 2.10 depends
- dplyr * imports
- generics * imports
- glue * imports
- here * imports
- httr * imports
- jsonlite * imports
- purrr * imports
- rlang * imports
- rvest * imports
- stringr * imports
- tibble * imports
- tidyr * imports
- ggplot2 * suggests
- knitr * suggests
- progress * suggests
- rmarkdown * suggests
- testthat * suggests
Score: 3.2188758248682006