fhir_table_description-class | R Documentation |
fhir_crack()
A fhir_table_description
holds the information fhir_crack()
needs to flatten (aka crack) FHIR resources from a FHIR bundle and
is created with its constructor function fhir_table_description()
.
Each fhir_table_description
describes a table for a specific resource type as fhir_crack()
will create one data.frame/data.table
per resource type. See Details.
A fhir_table_description
consists of
the following elements:
The resource element: Defines the resource type (e.g. Patient
or Observation
). See fhir_resource_type()
.
The cols element: Contains the column names and XPath expressions defining the columns to extract.
If this element is empty, fhir_crack()
will extract all available elements of the resource and name the
columns automatically. See fhir_columns()
.
The sep element: A character of length one containing the separator string used for separating multiple entries in cells.
The brackets element: A character of length one or two used for the indices of multiple entries. The first one is the opening bracket
and the second one the closing bracket. Vectors of length one will be recycled.
Defaults to character(0)
, i.e. no brackets, meaning that multiple entries won't be indexed.
The rm_empty_cols element: A logical of length one indicating whether empty columns should be removed in the resulting table or not. Defaults to FALSE
.
The format element: A character of length one indicating whether the resulting table should be cracked to a wide
or compact
format.
wide
means multiple entries will be distributed over several columns with indexed names. compact
means multiple entries will be pasted into one cell/column separated by sep
.
Defaults to compact
.
The keep_attr element: A logical of length one indicating whether the attribute name of the respective element (@value
in most cases)
should be attached to the name of the variable in the resulting table. Defaults to FALSE
.
A full fhir_table_description
looks for example like this:
fhir_resource_type: Patient fhir_columns: column name | xpath expression ------------------------ name | name/family gender | gender id | id sep: ':::' brackets: '[', ']' rm_empty_cols: FALSE format: 'compact' keep_attr: FALSE
resource
An object of class fhir_resource_type defining the resource type that should be extracted.
cols
An object of class fhir_columns describing which columns should be created and how.
If this is an empty fhir_columns object, the call to fhir_crack()
will extract all available
elements and put them in automatically named columns.
sep
A character of length one containing the separator string used for separating multiple entries in cells when format = "compact"
.
ignored when format = "wide"
.
brackets
A character of length one or two used for the indices of multiple entries. The first one is the opening bracket
and the second one the closing bracket. Vectors of length one will be recycled.
Defaults to character(0)
, i.e. no brackets, meaning that multiple entries won't be indexed.
rm_empty_cols
A logical of length one indicating whether empty columns should be removed from the resulting table or not. Defaults to FALSE.
format
A character of length one indicating whether the resulting table should be cracked to a wide
or compact
format.
wide
means multiple entries will be distributed over several columns with indexed names. compact
means multiple entries will be pasted into one cell/column separated by sep
.
Defaults to compact
.
keep_attr
A logical of length one indicating whether the attribute name of the respective element (@value
in most cases)
should be attached to the name of the variable in the resulting table. Defaults to FALSE
fhir_resource_type()
,fhir_columns()
, fhir_design()
, fhir_crack()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.