Learn R Programming

fhircrackr (version 2.1.1)

fhir_columns: Create fhir_columns object

Description

An object of class fhir_columns is part of a fhir_table_description in a fhir_design and holds information on the elements that should be extracted from the FHIR resources, as well as the column names of the resulting data.frame. The elements to be extracted are indicated by XPath xpaths. If no column names are provided, they are generated automatically and reflect the elements position in the resource.

Usage

fhir_columns(xpaths, colnames)

# S4 method for missing,missing fhir_columns()

# S4 method for `NULL`,missing fhir_columns(xpaths)

# S4 method for character,character fhir_columns(xpaths, colnames)

# S4 method for character,missing fhir_columns(xpaths)

# S4 method for list,missing fhir_columns(xpaths)

Arguments

xpaths

A (named) character vector or (named) list containing xpath xpaths, or a fhir_xpath_expression object.

colnames

The names of the columns to create. If no colnames are provided and the list or vector in xpaths has names, those names are taken as the colnames. If no colnames are provided and xpaths is unnamed too, the colnames are generated automatically from the xpath xpaths. See examples.

Examples

Run this code
 #provide colnames explicitly
 fhir_columns(xpaths = c("name/given", "code/coding/code"),
              colnames = c("name", "code"))

 #colnames are taken from xpaths argument
 fhir_columns(xpaths = c(name = "name/given", code = "code/coding/code"))

 #colnames are taken from xpaths argument
 fhir_columns(xpaths = list(name = "name/given", code = "code/coding/code"))

 #colnames are generated automatically
 fhir_columns(xpaths = c("name/given", "code/coding/code"))

Run the code above in your browser using DataLab