Learn R Programming

fhircrackr (version 0.2.1)

fhir_rm_indices: Remove indices from data frame

Description

Removes the indices produced by fhir_crack when add_indices=TRUE

Usage

fhir_rm_indices(
  indexed_data_frame,
  brackets = c("<", "="">"),
  columns = names(indexed_data_frame)
)

Arguments

indexed_data_frame

A data frame with indices for multiple entries as produced by fhir_crack

brackets

A string vector of length two defining the brackets that were used in fhir_crack

columns

A string vector of column names, indicating from which columns indices should be removed. Defaults to all columns.

Value

A data frame without indices.

Examples

Run this code
# NOT RUN {
bundle <- xml2::read_xml(
"<Bundle>

        <Patient>
            <id value='id1'/>
            <address>
                <use value='home'/>
                <city value='Amsterdam'/>
                <type value='physical'/>
               <country value='Netherlands'/>
            </address>
            <birthDate value='1992-02-06'/>
        </Patient>

        <Patient>
            <id value='id2'/>
            <address>
                <use value='home'/>
                <city value='Rome'/>
                <type value='physical'/>
                <country value='Italy'/>
            </address>
            <address>
                <use value='work'/>
                <city value='Stockholm'/>
                <type value='postal'/>
                <country value='Sweden'/>
            </address>
            <birthDate value='1980-05-23'/>
        </Patient>
</Bundle>"
)


dfs <- fhir_crack(bundles = list(bundle),
                  design = list(Patients = list(resource = "/Bundle/Patient")),
                  brackets = c("[", "]"),verbose = 2)

df_indices_removed <- fhir_rm_indices(dfs[[1]], brackets=c("[", "]"))
# }

Run the code above in your browser using DataLab