Search for traits from BETYdb
Get details about a single item from a table
betydb_record(
id,
table,
api_version = NULL,
betyurl = NULL,
fmt = NULL,
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)betydb_trait(
id,
genus = NULL,
species = NULL,
api_version = NULL,
betyurl = NULL,
fmt = "json",
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)
betydb_specie(
id,
genus = NULL,
species = NULL,
api_version = NULL,
betyurl = NULL,
fmt = "json",
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)
betydb_citation(
id,
genus = NULL,
species = NULL,
api_version = NULL,
betyurl = NULL,
fmt = "json",
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)
betydb_site(
id,
api_version = NULL,
betyurl = NULL,
fmt = "json",
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)
betydb_experiment(
id,
api_version = NULL,
betyurl = NULL,
fmt = "json",
key = NULL,
user = NULL,
pwd = NULL,
progress = TRUE,
...
)
(integer) One or more ids for a species, site, variable, etc.
(character) Name of the database table with which this ID is associated.
(character) Which version of the BETY API should we query? One of "v0" or "beta". Default is options("betydb_api_version")
if set, otherwise "v0".
(string) url to target instance of betydb. Default is options("betydb_url")
if set, otherwise "https:/www.betydb.org/"
(character) Format to return data in, one of json, xml, csv. Only json currently supported.
(character) An API key. Use this or user/pwd combo. Save in your
.Rprofile
file as options(betydb_key = "your40digitkey")
. Optional
(character) A user name and password. Use a user/pwd combo or an API key.
Save in your .Rprofile
file as options(betydb_user = "yournamehere")
and options(betydb_pwd = "yourpasswordhere")
. Optional
show progress bar? default: TRUE
Curl options passed on to GET
. Optional
(character) A genus name. Optional
(character) A specific epithet. Optional
Defers to use API key first since it's simpler, but if you don't have an API key, you can supply a username and password.
Singular functions like betydb_trait
accept an id and additional parameters,
and return a list of variable outputs depending on the inputs.
However, plural functions like betydb_traits
accept query parameters, but not
ids, and always return a single data.frame.
betydb_search("Search terms", ...)
is a convenience wrapper that passes all further arguments to betydb_query(table = "search", search = "Search terms", ...)
. See there for details on possible arguments.
BETYdb includes a primary home page (betydb.org) focused on bioenergy crops as well as a network of harmonized databases that support and share data among more focused research programs.
For a list of publicly accessible instances of BETYdb and the urls that can be queried, see https://pecan.gitbooks.io/betydb-documentation/content/distributed_betydb.html
This package queries plant traits, phenotypes, biomass yields, and ecosystem functions. It does not currently interface with the workflow and provenance data that support PEcAn Project (pecanproject.org) and TERRA REF (terraref.org) software.
API documentation: https://pecan.gitbooks.io/betydb-data-access/content/API.html
API endpoints are here: https://www.betydb.org/api/docs
This package currently uses the original 'v0' API by default.
To use a newer version, set api_version
.
Newer versions of the API will support database inserts.
API documentation https://pecan.gitbooks.io/betydb-data-access/content/API.html and https://www.betydb.org/api/docs
betydb_query
if (FALSE) {
# General Search
out <- betydb_search(query = "Switchgrass Yield")
library("dplyr")
out %>%
group_by(id) %>%
summarise(mean_result = mean(as.numeric(mean), na.rm = TRUE)) %>%
arrange(desc(mean_result))
# Get by ID
## Traits
betydb_trait(id = 10)
## Species
betydb_specie(id = 1)
## Citations
betydb_citation(id = 1)
## Site information
betydb_site(id = 795)
}
Run the code above in your browser using DataLab