View source: R/multiple_entries.R
fhir_common_columns | R Documentation |
This is a convenience function to find all column names in a data frame starting with the same string that can
then be used for fhir_melt()
.
fhir_common_columns(data_frame, column_names_prefix)
data_frame |
A data.frame/data.table with automatically named columns as produced by |
column_names_prefix |
A string containing the common prefix of the desired columns. |
It is intended for use on data frames with column names that have been automatically produced by fhir_design()
/fhir_crack()
and follow the form level1.level2.level3
such as name.given
or code.coding.system
.
Note that this function will only work on column names following exactly this scheme.
The resulting character vector can be used for melting all columns belonging to the same attribute in an indexed data frame,
see ?fhir_melt
.
A character vector with the names of all columns matching column_names_prefix
.
fhir_melt()
, fhir_rm_indices()
#unserialize example bundles
bundles <- fhir_unserialize(bundles = medication_bundles)
#crack Patient Resources
pats <- fhir_table_description(resource = "Patient")
df <- fhir_crack(bundles = bundles, design = pats)
#look at automatically generated names
names(df)
#extract all column names beginning with the string "name"
fhir_common_columns(data_frame = df, column_names_prefix = "name")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.