abMark: Get abnormal mark

getAbnormalMarkR Documentation

Get abnormal mark

Description

getAbnormalMark generates a new column recorded abnormal values: high H and L.

Usage

getAbnormalMark(
  labData,
  idColName,
  labItemColName,
  valueColName,
  genderColName,
  genderTable,
  referenceTable = refLOINC
)

Arguments

labData

a file or dataframe of laboratory test data with at least 4 columns about patient ID, lab item, test value and test date, respectively.

idColName

the column name that records patient ID in labData.

labItemColName

the column name that records lab item in labData. If lab code is combined by multiple columns, then just simply add + operator between column names, e.g., A + B.

valueColName

the column name that records test value in labData. Only numeric value is acceptable.

genderColName

the column name that records gender of each patient. Gender should be coded as M or F.

referenceTable

a data table that records reference values of each lab item. Column names should be: LowerBound_Male, UpperBound_Male, LowerBound_Female, UpperBound_Female. The labItemColName of labData and refLOINC have to be the same.

Details

This step is optional but recommended. Reference ranges differ in different institutions, so a user-defined reference table is needed. The table should record the reference values for male and female separately. Lower bound can be expressed as <, ( (greater than) or <= , [ (great tham or euqal to), and the expression of upper bound is similar. If there is no upper bound or lower bound, just remain empty. After the new abnormal flag column generated, it can be used to do categorical analysis, or be used in the function: plotTimeSeriesLab.

Value

A data.table merged two tables.

Examples

loincSample <- mapLOINC(labData = labSample,
                       labItemColName = ITEMID,
                       mappingTable = mapSample)

#Use LONIC table (default)
getAbnormalMark(labData = loincSample,
               idColName = SUBJECT_ID,
               labItemColName = LOINC,
               valueColName = VALUENUM,
               genderColName = GENDER,
               genderTable = patientSample,
               referenceTable = refLOINC)

#Use user define table
getAbnormalMark(labData = labSample,
               idColName = SUBJECT_ID,
               labItemColName = ITEMID,
               valueColName = VALUENUM,
               genderColName = GENDER,
               genderTable = patientSample,
               referenceTable = refUserDefine)


DHLab-TSENG/lab documentation built on Sept. 1, 2023, 9:03 p.m.