Learn R Programming

ctrdata (version 1.15.2)

dbFindFields: Find names of fields in the database collection

Description

Given part of the name of a field of interest to the user, this function returns the full field names used in records that were previously loaded into a collection (using ctrLoadQueryIntoDb). The field names can be fed into function dbGetFieldsIntoDf to extract the data from the collection into a data frame.

Usage

dbFindFields(namepart = "", con, verbose = FALSE)

Value

Vector of strings with full names of field(s) found, ordered by register and alphabet. This is a named vector where the names of the vector elements are the register names for the respective fields.

Arguments

namepart

A character string (can include a regular expression, including Perl-style) to be searched for among all field names (keys) in the collection, case-insensitive. Use ".*" to find all fields.

con

A connection object, see section `Databases` in ctrdata.

verbose

If TRUE, prints additional information (default FALSE).

Details

In addition to the full names of all child fields (e.g., clinical_results.outcome_list.outcome.measure.class_list.class.title) this function may return names of parent fields (e.g., clinical_results). Data in parent fields is typically complex (multiply nested) and can be converted into individual data elements by function dfTrials2Long, and subelements can be accessed with function dfName2Value.

For fields in "EUCTR" (protocol- and results-related information), https://eudract.ema.europa.eu/result.html.

For fields in "CTGOV" (protocol-related information), see https://prsinfo.clinicaltrials.gov/definitions.html.

For fields in "ISRCTN" (protocol-related information), see https://www.isrctn.com/page/definitions.

Note: Only when dbFindFields is first called after ctrLoadQueryIntoDb, it will take a moment.

Examples

Run this code

dbc <- nodbi::src_sqlite(
   dbname = system.file("extdata", "demo.sqlite", package = "ctrdata"),
   collection = "my_trials")

dbFindFields(namepart = "date", con = dbc)

Run the code above in your browser using DataLab