dbFindFields {ctrdata}R Documentation

Find names of fields in the database collection


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. In addition to the full names of leaf fields (e.g., clinical_results.outcome_list.outcome.measure.class_list.class.title) this function also returns names of node fields (e.g., clinical_results). Data in node fields is typically complex (multiply nested) and can be converted into individual data elements by function dfTrials2Long, possibly followed by function dfName2Value.


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



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


A connection object, see section 'Databases' in ctrdata-package


If TRUE, prints additional information (default FALSE).


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.


Vector of strings with full names of field(s) found, in alphabetical order by register. This is a named vector where the names of the vector are the register names for the respective fields.


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

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

[Package ctrdata version 1.11.1 Index]