R Under development (unstable) (2025-10-08 r88906 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(medicalcoder) > > ################################################################################ > # Verify the summary table output for pccc_v3.0 with flag.method = current is as expected > rtn <- comorbidities(data = mdcr, id.vars = "patid", icd.codes = "code", poa = 1, flag.method = 'current', method = "pccc_v3.0") > rtn <- summary(rtn) > > stopifnot( + inherits(rtn, "data.frame"), + identical( + names(rtn), + c("condition", "label", + "dxpr_or_tech_count", "dxpr_or_tech_percent", + "dxpr_only_count", "dxpr_only_percent", + "tech_only_count", "tech_only_percent", + "dxpr_and_tech_count", "dxpr_and_tech_percent") + ), + is.character(rtn[["condition"]]), + is.character(rtn[["label"]]), + is.integer(rtn[["dxpr_or_tech_count"]]), + is.numeric(rtn[["dxpr_or_tech_percent"]]), + is.integer(rtn[["dxpr_only_count"]]), + is.numeric(rtn[["dxpr_only_percent"]]), + is.integer(rtn[["tech_only_count"]]), + is.numeric(rtn[["tech_only_percent"]]), + is.integer(rtn[["dxpr_and_tech_count"]]), + is.numeric(rtn[["dxpr_and_tech_percent"]]) + ) > > ################################################################################ > # Verify the summary table output for pccc_v3.0 with flag.method = cumulative is as expected > cmb <- comorbidities(data = mdcr_longitudinal, id.vars = c("patid", "date"), icd.codes = "code", poa = 1, flag.method = 'cumulative', method = "pccc_v3.0") > rtn <- tryCatch(summary(cmb), warning = function(w) w) > stopifnot(inherits(rtn, "warning")) > > rtn <- suppressWarnings(summary(cmb)) > stopifnot( + inherits(rtn, "data.frame"), + identical( + names(rtn), + c("condition", "label", + "dxpr_or_tech_count", "dxpr_or_tech_percent", + "dxpr_only_count", "dxpr_only_percent", + "tech_only_count", "tech_only_percent", + "dxpr_and_tech_count", "dxpr_and_tech_percent") + ), + is.character(rtn[["condition"]]), + is.character(rtn[["label"]]), + is.integer(rtn[["dxpr_or_tech_count"]]), + is.numeric(rtn[["dxpr_or_tech_percent"]]), + is.integer(rtn[["dxpr_only_count"]]), + is.numeric(rtn[["dxpr_only_percent"]]), + is.integer(rtn[["tech_only_count"]]), + is.numeric(rtn[["tech_only_percent"]]), + is.integer(rtn[["dxpr_and_tech_count"]]), + is.numeric(rtn[["dxpr_and_tech_percent"]]) + ) > > ################################################################################ > # Verify the summary table output for pccc_v3.1 is as expected > rtn <- comorbidities(data = mdcr, id.vars = "patid", icd.codes = "code", poa = 1, flag.method = 'current', method = "pccc_v3.1") > rtn <- summary(rtn) > > stopifnot( + inherits(rtn, "data.frame"), + identical( + names(rtn), + c("condition", "label", + "dxpr_or_tech_count", "dxpr_or_tech_percent", + "dxpr_only_count", "dxpr_only_percent", + "tech_only_count", "tech_only_percent", + "dxpr_and_tech_count", "dxpr_and_tech_percent") + ), + is.character(rtn[["condition"]]), + is.character(rtn[["label"]]), + is.integer(rtn[["dxpr_or_tech_count"]]), + is.numeric(rtn[["dxpr_or_tech_percent"]]), + is.integer(rtn[["dxpr_only_count"]]), + is.numeric(rtn[["dxpr_only_percent"]]), + is.integer(rtn[["tech_only_count"]]), + is.numeric(rtn[["tech_only_percent"]]), + is.integer(rtn[["dxpr_and_tech_count"]]), + is.numeric(rtn[["dxpr_and_tech_percent"]]) + ) > > ################################################################################ > # PCCC Version 2.0 > > rtn <- comorbidities(data = mdcr, id.vars = "patid", icd.codes = "code", poa = 1, flag.method = 'current', method = "pccc_v2.0") > rtn <- summary(rtn) > > stopifnot( + inherits(rtn, "data.frame"), + identical( + names(rtn), + c("condition", "label", "count", "percent") + ), + is.character(rtn[["condition"]]), + is.character(rtn[["label"]]), + is.integer(rtn[["count"]]), + is.numeric(rtn[["percent"]]) + ) > > > ################################################################################ > # PCCC Version 2.1 > > rtn <- comorbidities(data = mdcr, id.vars = "patid", icd.codes = "code", poa = 1, flag.method = 'current', method = "pccc_v2.1") > rtn <- summary(rtn) > > stopifnot( + inherits(rtn, "data.frame"), + identical( + names(rtn), + c("condition", "label", "count", "percent") + ), + is.character(rtn[["condition"]]), + is.character(rtn[["label"]]), + is.integer(rtn[["count"]]), + is.numeric(rtn[["percent"]]) + ) > > ################################################################################ > # End of File # > ################################################################################ > > proc.time() user system elapsed 7.62 0.82 8.43