#Example 1: Remove tag from xmls in a character vector
string <- c("HelloPleaseRemove Me World!",
"ABCD")
fhir_rm_tag(x = string, tag = "p")
#Example 2: Remove div tags in a single fhir bundle
bundle <- fhir_unserialize(patient_bundles)[[1]]
#example bundle contains html parts in div tags:
cat(toString(bundle))
#remove html parts
bundle_cleaned <- fhir_rm_tag(x = bundle, tag = "div")
#have a look at the result
cat(toString(bundle_cleaned))
#Example 3: Remove div tags in a list of fhir bundles
bundle_list <- fhir_unserialize(patient_bundles)
#remove html parts
bundle_list_cleaned <- fhir_rm_tag(x = bundle_list, tag = "div")
#check out how much the size of the bundle list is reduced by removing html
size_with_html <- sum(sapply(bundle_list, function(x)object.size(toString(x))))
size_without_html <- sum(sapply(bundle_list_cleaned, function(x)object.size(toString(x))))
size_without_html/size_with_html
Run the code above in your browser using DataLab