Skip to contents

This function takes a search expression and character vector with any number of field names and returns one dataframe with the merged and parsed csv API response.

Usage

get_study_fields(
  search_expr,
  fields,
  max_studies = 500,
  response_content = FALSE
)

Arguments

search_expr

A string following the querying guidelines at https://clinicaltrials.gov/api/gui/ref/syntax and https://clinicaltrials.gov/api/gui/ref/expr

fields

A character vector with field names. All field names available at https://clinicaltrials.gov/api/info/study_fields_list?fmt=JSON, with "all_fields", or with "get_vector_all_study_fields()"

max_studies

A number indicating how many studies of all the ones that match the search expression will be returned.

response_content

Logical indicating whether the returned object is the unparsed but decoded, content of the API query response. Will only return first 20 fields in fields argument. Suited for troubleshooting.

Examples

get_study_fields(expr = 'heart attack',fields = all_fields)
#> Error in get_study_fields(expr = "heart attack", fields = all_fields): unused argument (expr = "heart attack")