Unboxing refers to the process of both unmerging a column, either a label or a strip, while also separating rowwise by the `sep` argument. It is meant to isolate the Concept attributes from a merge column while also taking in account that rowwise aggregates may have also occurred, and without separating these values out, some concepts in the source data may be misparsed.

unbox_label(data, label_col, sep = "\n", remove = FALSE)

See also

Examples

library(tidyverse) library(chariot) get_strip(concept_id = 1112807, vocab_schema = "omop_vocabulary")
#> [2021-05-26 16:07:53] Connected to 'athena' #> [2021-05-26 16:07:53] Loading Cache... #> [2021-05-26 16:07:53] Cached SQL: SELECT * FROM omop_vocabulary.concept c WHERE c.concept_id IN (1112807) #> [2021-05-26 16:07:53] Cached resultset found... #> [2021-05-26 16:07:53] Postgres connection to 'athena' closed
#> [1] "[V] [S] 1112807 aspirin [RxNorm 1191] [Drug] [Ingredient]"
test_strip <- tibble::tibble(concept = "[V] [S] 1112807 aspirin [RxNorm 1191] [Drug] [Ingredient]") unmerge_strip(test_strip, strip_col = concept)
#> # A tibble: 1 x 8 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <chr> <chr> <chr> <chr> <chr> #> 1 1112807 aspirin Drug RxNorm Ingredient #> # … with 3 more variables: standard_concept <chr>, concept_code <chr>, #> # invalid_reason <chr>
unbox_strip(test_strip, strip_col = concept)
#> # A tibble: 1 x 8 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <chr> <chr> <chr> <chr> <chr> #> 1 1112807 aspirin Drug RxNorm Ingredient #> # … with 3 more variables: standard_concept <chr>, concept_code <chr>, #> # invalid_reason <chr>
test_strip <- tibble::tibble(concept = "[V] [S] 1112807 aspirin [RxNorm 1191] [Drug] [Ingredient]\n[V] [S] 1112807 aspirin [RxNorm 1191] [Drug] [Ingredient]") unbox_strip(test_strip, strip_col = concept)
#> # A tibble: 2 x 8 #> concept_id concept_name domain_id vocabulary_id concept_class_id #> <chr> <chr> <chr> <chr> <chr> #> 1 1112807 aspirin Drug RxNorm Ingredient #> 2 1112807 aspirin Drug RxNorm Ingredient #> # … with 3 more variables: standard_concept <chr>, concept_code <chr>, #> # invalid_reason <chr>