prefix_to_record: Add the prefix to appropriate ICD-9 record columns

View source: R/prefix_to_record.R

prefix_to_recordR Documentation

Add the prefix to appropriate ICD-9 record columns

Description

For record columns, codes between 800-999 can be either nature of injury (N) or external cause of innjury (E) codes. To determine the correct code, there is a corresponding nature of injury flag column where 0 indicates an E code and 1 indicates an N code. This takes the record/flag pair of columns and prefixes the record column as appropriate.

Usage

prefix_to_record(record_col, rnifla_col)

Arguments

record_col

The record column from an ICD-9 dataframe

rnifla_col

The corresponding nature of injury flag column

Value

vector

Examples

record_col <- c(7500, 8000, 8001, 9999, 10000)
rnifla_col <- c(0, 1, 0, 1, 0)
prefix_to_record(record_col, rnifla_col)

mkiang/narcan documentation built on Sept. 26, 2024, 7:18 a.m.