plotDiagCat: Plot of diagnostic categories

View source: R/plotDiagCat.R

plotDiagCatR Documentation

Plot of diagnostic categories

Description

Histogram plot of diagnostic categories

Usage

plotDiagCat(
  groupedDataWide,
  idColName,
  groupColName = NULL,
  topN = 10,
  limitFreq = 0.01,
  pvalue = 0.05
)

Arguments

groupedDataWide

Wide table of data frame (generated from groupedDataLongToWide function).

topN

Numeric. Default is 10 (Top 10; 10 most common wrong ICD).

limitFreq

Numeric. minimum frequency shown (frequency below this threshold will not be shown in plot). Default is 0.01. In other words, the threshold is 1 percent patient among total patients been diagnosed in the same diagnostic category.

pvalue

Numeric. p value of chisq.test. Default is 0.05.

Details

This function provides an overview of grouping category of the diagnostic code in histogram plot. User can observe the proportion of diagnostic categories in their dataset through this function. Also, Chi-square test and Fisher’s exact test are also included in this function. User can test if the proportion of each diagnostic category in case group and control group are statistical significantly different.

Value

A histogram plot and a data.table of summarized classified data.

See Also

Other plot function: plotICDError

Examples

# sample file for example
head(sampleDxFile)

# Create a grouped data

ELIX <- icdDxToComorbid(dxDataFile = sampleDxFile,
                       idColName = ID,
                       icdColName = ICD,
                       dateColName = Date,
                       icd10usingDate = "2015/10/01",
                       comorbidMethod = elix)

head(ELIX$groupedDT)

# Convert long format of grouped data into wide binary format

groupedDataWide <- groupedDataLongToWide(ELIX$groupedDT,
                                         idColName = ID,
                                         categoryColName = Comorbidity,
                                         dateColName = Date)

# plot of top 10 common grouped categories and a list of the detail of grouped categories

plot1 <- plotDiagCat(groupedDataWide = groupedDataWide,
                          idColName = ID,
                          topN = 10,
                          limitFreq = 0.01)
plot1

# Select case with "Diseases of the urinary system" by level 2 of CCS classification

selectedCaseFile <- selectCases(dxDataFile = sampleDxFile,
                                idColName = ID,
                                icdColName = ICD,
                                dateColName = Date,
                                icdVerColName = NULL,
                                icd10usingDate = "2015/10/01",
                                groupDataType = ccslvl2,
                                caseCondition = "Diseases of the urinary system",
                                caseCount = 1)

# Convert the long format of grouped data into a wide binary format with selected case

groupedDataWide <- groupedDataLongToWide(ELIX$groupedDT,
                                         idColName = ID,
                                         categoryColName = Comorbidity,
                                         dateColName = Date,
                                         selectedCaseFile = selectedCaseFile)

# plot of top 10 common grouped categories and a list of the detail of grouped categories

plot2 <- plotDiagCat(groupedDataWide = groupedDataWide,
                          idColName = ID,
                          topN = 10,
                          limitFreq = 0.01,
                          pvalue = 0.05,
                          groupColName = selectedCase)
plot2

DHLab-CGU/emr documentation built on Sept. 2, 2023, 9:16 p.m.