ctg_get_nct {clintrialx} | R Documentation |
Fetch Clinical Trial Data Based on NCT ID
Description
Retrieves data for one or more clinical trials from the ClinicalTrials.gov API based on their NCT ID(s).
Usage
ctg_get_nct(nct_ids, fields = NULL)
Arguments
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. |
Details
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.
Value
A tibble containing the clinical trial data with columns matching the requested fields.
Field Names Guide
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
Examples
# 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