filter_at_all_strip: Filter Multiple Concept Strip Columns

Description Usage Arguments Value See Also Examples

View source: R/format.R

Description

This function performs the same style of filtering as filter_strip over multiple columns.

Usage

1

Arguments

data

Dataframe

...

Filter arguments passed to the dplyr filter function using the base Concept Table fields.

merge_cols

Character vector of column names to filter

all

Equivalent to the 'all_vars()' variable predicate in the Tidyverse system. If TRUE, all 'merge_cols' are filtered for. If FALSE, the equivalent to 'any_vars()' is performed. Default: TRUE

Value

A tibble.

See Also

filterStrip select,select_all,bind,filter_all,filter,distinct separate_rows normalize_all_to_na

Other concept format functions: filter_at_any_strip(), filter_strip(), get_strip(), label_to_strip(), merge_label(), merge_strip(), unbox_label(), unbox_strip(), unmerge_label(), unmerge_strip()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
library(tidyverse)
library(chariot)

conn <- connectAthena()
test_data <-
        queryAthena("SELECT * FROM omop_vocabulary.concept ORDER BY RANDOM() LIMIT 20;",
                    conn = conn)

# Merge
merge_strip(data = test_data,
            into = "concept")

# Merge while sparing some original columns such as vocabulary_id and
# concept_class_id
merge_strip(data = test_data,
            into = "concept",
            vocabulary_id,
            concept_class_id)



# Test filtering of strip columns
test_output <- merge_strip(data = test_data,
                        into = "concept") %>%
                dplyr::select(-concept_id)

# Filter at a Strip Column
filter_strip(test_output,
             strip_col = concept,
             vocabulary_id %in% c("SNOMED"))

# Filter at more than 1 Strip Column
test_data <-
        dplyr::bind_cols(test_output %>%
                                 rubix::randomize() %>%
                                 dplyr::select(concept_a = concept),
                         test_output %>%
                                 rubix::randomize() %>%
                                 dplyr::select(concept_b = concept))

filter_at_all_strip(data = test_data,
                strip_cols = c("concept_a",
                               "concept_b"),
                vocabulary_id %in% c("RxNorm"))

filter_at_any_strip(data = test_data,
                    strip_cols = c("concept_a",
                                   "concept_b"),
                    vocabulary_id %in% c("RxNorm"))

dcAthena(conn = conn)

patelm9/chariot documentation built on Feb. 19, 2022, 11:29 a.m.