fhir_tree | R Documentation |
This function takes a wide table as created by fhir_crack()
with format="wide"
and creates the tree structure implicit in the
column names of the tables. It is useful to get an overview over the implied structure when planning to create
FHIR bundles from this table using fhir_build_bundle()
.
fhir_tree(
table,
brackets,
resource = "Resource",
keep_attr = FALSE,
keep_ids = FALSE,
skip_one = FALSE,
format = "plain",
prompt = ": "
)
table |
A data.frame or data.table as produced by |
brackets |
A character vector of length two. The brackets used in the table. |
resource |
A character vector of length one or fhir_resource_type object indicating which resource type the table is build from. |
keep_attr |
A logical vector of length one indicating whether attributes should be displayed or not.
Only used for formats |
keep_ids |
A logical vector of length one indicating whether indices should be displayed or not.
Only used for formats |
skip_one |
A logical vector of length one indicating whether first index 1 should be displayed or not.
Only used for formats |
format |
The format of the tree. One of |
prompt |
A character vector of length one use as prompt
Only used for formats |
A string that can be used with cat()
or can be written to a text file.
fhir_cast()
, fhir_build_bundle()
#' #unserialize example
bundles <- fhir_unserialize(bundles = example_bundles1)
#crack fhir resources
table_desc <- fhir_table_description(
resource = "Patient",
brackets = c("[", "]"),
sep = " ",
format = "wide"
)
df <- fhir_crack(bundles = bundles, design = table_desc)
###show tree
#plain format
cat(fhir_tree(
table = df,
brackets = c("[", "]"),
resource = "Patient"
)
)
#fancy format with indices
cat(fhir_tree(
table = df,
brackets = c("[", "]"),
resource = "Patient",
format = "fancy",
keep_ids = TRUE
)
)
#xml format
cat(fhir_tree(
table = df,
brackets = c("[", "]"),
resource = "Patient",
format = "xml"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.