library(biosysR)
The BioSys API is only accessible with basicauth using a valid Biosys username and password.
All biosysR
functions calling the BioSys API expect optional parameters un
and pw
, which default to environment variables BIOSYS_UN
and BIOSYS_UN
,
respectively. Calling biosysR
functions with invalid or empty, credentials, or
defaulting to non existing BIOSYS_UN
and BIOSYS_PW
will fail with an
informative error message prompting for correct authentication.
There are three ways to supply these authentication credentials to biosysR
functions.
To set-and-forget BioSys authentication, add to your ~/.Rprofile
:
Sys.setenv(BIOSYS_UN = "USERNAME") Sys.setenv(BIOSYS_PW = "PASSWORD")
Every new R session will already contain these variables.
To authenticate one session, export BIOSYS_UN/PW
as environment variables:
Sys.setenv(BIOSYS_UN = "USERNAME") Sys.setenv(BIOSYS_PW = "PASSWORD")
Restarting the R session will clear these variables.
Supply the variables to each biosysR
function:
biosys_projects
biosys_datasets
biosys_records
projects <- biosys_projects(un="USERNAME", pw="PASSWORD")
Doing so will hand un
and pw
to biosys_get
, which builds the authentication
headers and uses them in the request to BioSys.
tibble
.projects <- biosys_projects() dplyr::glimpse(projects) DT::datatable(projects)
datasets <- biosys_datasets(project_id = 6) dplyr::glimpse(datasets) listviewer::jsonedit(datasets$data_package) DT::datatable(datasets)
records <- biosys_records(project_id = 6) DT::datatable(head(records, n = 100))
The example data in this project were produced by saving one project's
project metadata, dataset metadata, and a subset of records to the data/
folder.
projects <- biosys_projects()[6,] datasets <- biosys_datasets(project_id = 6)[1,] records <- biosys_records(project_id = 6) %>% head(n = 100) devtools::use_data(projects, datasets, records)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.