R/drugs.R

Defines functions drugs_risk_factors

Documented in drugs_risk_factors

#' Drugs for risk factors
#'
#' [`GET /drugs/risk-factors`](https://docs.epigraphdb.org/api/api-endpoints/#get-drugsrisk-factors)
#'
#' @param trait A trait name
#' @inheritParams mr
#' @return Data from `GET /drugs/risk-factors`
#'
#' @examples
#' \dontrun{
#' drugs_risk_factors(trait = "Body mass index")
#' }
#' @export
drugs_risk_factors <- function(trait, pval_threshold = 1e-8,
                               mode = c("table", "raw")) {
  mode <- match.arg(mode)
  response <- query_epigraphdb(
    route = "/drugs/risk-factors",
    params = list(
      trait = trait,
      pval_threshold = pval_threshold
    ),
    mode = mode
  )
  response
}

Try the epigraphdb package in your browser

Any scripts or data that you put into this service are public.

epigraphdb documentation built on Jan. 15, 2022, 1:09 a.m.