requireNamespace("knitr") knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
In this example, we're going to demonstrate how to interact with the covariate services API using the gorr
package.
library(gorr) library(magrittr) # pipe
First we'll need to establish a connection to our API services. To do that we'll need to call platform_connect
and provide it with the relevant parameters pointing to the phenotype-catalog-service, i.e. api_key
and project
:
conn <- platform_connect(api_key = Sys.getenv("GOR_API_KEY"), project = Sys.getenv("GOR_API_PROJECT")) conn
If everything goes as planned, we'll have a conn
object to pass into subsequent functions.
Covariates available to users can be listed by passing the conn
object to get_covariates
.
covariates <- get_covariates(conn) covariates
The results come back as a list
of covariates available to the user.
Now can fetch a covariate from the project get_covariate
and passing the covariate's unique id
along with the conn
object .
covariate <- get_covariate(id = 1, conn) covariate
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.