icd9FilterPoa: Filters data frame based on present-on-arrival flag

Description Usage Arguments Functions Examples

View source: R/filter.R

Description

Present On Arrival (POA) is not a simple flag, since many codes are exempt, unspecified, or unknown. Therefore, two options are given: get all the comorbidities where the POA flag was definitely -ve, coded as "N" or definitely +ve and coded as "Y". Negating one set won't give the other set unless all codes were either Y or N. #describeIn icd9Comorbid

Usage

1
2
3
4
5
6
7
8
9
icd9FilterPoa(icd9df, poaField = "poa", poa = icd9PoaChoices)

icd9FilterPoaYes(icd9df, poaField = "poa")

icd9FilterPoaNo(icd9df, poaField = "poa")

icd9FilterPoaNotNo(icd9df, poaField = "poa")

icd9FilterPoaNotYes(icd9df, poaField = "poa")

Arguments

icd9df

data frame containing columns for visitId (which is the feault name), icd9 (default for the icd9 code), and maybe also a POA flag.

poaField

The name of column in the data frame which contains the Present On Arrival flag. The flag itself is a single character, typically one of "Y", "N", "E", "X", "U" or empty. The poaField is a character vector of length one.

poa

single character value, being one of poaChoices whether to account for co-morbidities flagged as present-on-arrival. This is not a simple binary, since many codes are exempt, unspecified, or unknown. poaField gives the choices: yes, not no, no, not yes. The intermediate codes, such as "exempt", "unknown" and NA mean that "yes" is not the same as "not no."

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# using magrittr is beautiful:
library("magrittr", quietly = TRUE, warn.conflicts = FALSE)
myData <- data.frame(
  visitId = c("v1", "v2", "v3", "v4"),
  diag = c("39891", "39790", "41791", "4401"),
  poa = c("Y", "N", NA, "Y"),
  stringsAsFactors = FALSE
)
myData %>% icd9FilterPoaNotNo() %>% icd9ComorbidAhrq
# can fill out named fields also:
myData %>% icd9FilterPoaYes(poaField="poa") %>%
  icd9ComorbidAhrq(icd9Field = "diag", visitId = "visitId", isShort = TRUE)
# can call the core icd9Comorbid function with an arbitrary mapping
myData %>%
icd9FilterPoaYes() %>%
icd9Comorbid(icd9Field = "diag", visitId = "visitId",
  icd9Mapping = quanElixComorbid,
 isShortMapping = TRUE)

## End(Not run)

jackwasey/icd9 documentation built on May 18, 2019, 7:57 a.m.