View source: R/fetch_specific_trial_data.R
ctg_get_nct | R Documentation |
Retrieves data for one or more clinical trials from the ClinicalTrials.gov API based on their NCT ID(s).
ctg_get_nct(nct_ids, fields = NULL)
nct_ids |
A character vector of one or more NCT IDs (e.g., "NCT04000165") for the clinical trials to fetch. |
fields |
A character vector specifying the fields to retrieve. If NULL (default), all available fields are fetched. If specified, it must be a subset of the available fields. |
This function allows you to specify one or more NCT IDs and optionally select specific fields of interest. It fetches the relevant data and returns it as a tibble.
The function constructs a request for each NCT ID, specifying the desired fields. It uses a progress bar to show the progress of fetching data for multiple trials. The data is returned as a tibble with columns corresponding to the requested fields. If any fetches fail or if the API response contains columns not requested, warnings will be issued.
Ensure that the fields
parameter contains valid field names as specified in the guide below. Invalid fields will result in an error.
A tibble containing the clinical trial data with columns matching the requested fields.
The following are the available fields you can request from ClinicalTrials.gov:
NCT Number
,
Study Title
,
Study URL
,
Acronym
,
Study Status
,
Brief Summary
,
Study Results
,
Conditions
,
Interventions
,
Primary Outcome Measures
,
Secondary Outcome Measures
,
Other Outcome Measures
,
Sponsor
,
Collaborators
,
Sex
,
Age
,
Phases
,
Enrollment
,
Funder Type
,
Study Type
,
Study Design
,
Other IDs
,
Start Date
,
Primary Completion Date
,
Completion Date
,
First Posted
,
Results First Posted
,
Last Update Posted
,
Locations
,
Study Documents
# Fetch data for a single NCT ID
trial_data <- ctg_get_nct("NCT04000165")
trial_data
# Fetch data for multiple NCT IDs
multiple_trials <- ctg_get_nct(c("NCT04000165", "NCT04002440"))
multiple_trials
# Fetch data for multiple NCT IDs with specific fields
specific_fields <- ctg_get_nct(
c("NCT04000165", "NCT04002440"),
fields = c("NCT Number", "Study Title", "Study Status")
)
specific_fields
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.