rollup_phecode_pairs: Rollup binary phecode pairs

Description Usage Arguments Value Examples

View source: R/rollup_phecode_pairs.R

Description

Takes phecodes that have been coded without rollup - E.g. existance of code 008.10 does not imply the existance of 008.00 - and produces a rolledup version of the dataset. Works with plain patient-phecode pairs and also with patient-code-count triplets.

Usage

1
2
3
4
5
rollup_phecode_pairs(
  patient_code_counts,
  patient_col = patient,
  phecode_col = phecode
)

Arguments

patient_code_counts

Data containing patient ids, phecodes, and counts of those phecodes.

patient_col

Unquoted name of the column containing patient ids in passed patient_code_counts's dataframe.

phecode_col

Unquoted name of the column containing phecodes in passed dataframe.

Value

Dataframe in same format as passed patient_code_counts with code counts rolled up. This will most likely be longer than the original dataset because of the addition of potentially previously ommitted codes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(dplyr)

patient_data <- tribble(
  ~patient,    ~code,
         1, "250.23",
         1, "250.25",
         1, "696.42",
         1, "555.21",
         2, "401.22",
         2, "204.21",
         2, "735.22",
         2, "751.11",
)


# Also works with just binary occurance pairs
patient_data %>%
  rollup_phecode_pairs(patient_col = patient,
                  phecode_col = code)

nstrayer/phewasHelper documentation built on April 2, 2020, 5:06 a.m.