From d2431a22ac58fafc72ccad68b803e82cac937372 Mon Sep 17 00:00:00 2001 From: Jinseob Kim Date: Sat, 13 Jul 2024 17:43:33 +0900 Subject: [PATCH] 1.3.1 --- DESCRIPTION | 4 ++-- NEWS.md | 5 +++++ R/CreateTableOneJS.R | 2 +- R/svyCreateTableOneJS.R | 8 ++++---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9490a5f..a0b385c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: jstable Title: Create Tables from Different Types of Regression -Version: 1.3.0 -Date: 2024-07-05 +Version: 1.3.1 +Date: 2024-07-13 Authors@R: c(person("Jinseob", "Kim", email = "jinseob2kim@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")), person("Zarathu", role = c("cph", "fnd")), person("Yoonkyoung","Jeon", role = c("aut")), diff --git a/NEWS.md b/NEWS.md index 7cbe7ac..8ac4422 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# jstable 1.3.1 + +* Fix: `addOverall` options to `svyCreateTableOneJS` + + # jstable 1.3.0 * Update: Add `weights` option to `TableSubgroupCox` and `TableSubgroupMultiCox` for marginal cox model. ex: `weights = "weights"` diff --git a/R/CreateTableOneJS.R b/R/CreateTableOneJS.R index b147a1b..e65aeb4 100644 --- a/R/CreateTableOneJS.R +++ b/R/CreateTableOneJS.R @@ -128,7 +128,7 @@ CreateTableOne2 <- function(data, strata, vars, factorVars, includeNA = F, test if (Labels & !is.null(labeldata)) { colname.group_var <- unlist(labeldata[.(strata, names(res$CatTable)), val_label]) - if (is.na(colname.group_var[1])) { + if (is.na(colname.group_var[1]) & addOverall) { colname.group_var[1] <- "Overall" } if (showAllLevels == T) { diff --git a/R/svyCreateTableOneJS.R b/R/svyCreateTableOneJS.R index f6e9248..084ae1b 100644 --- a/R/svyCreateTableOneJS.R +++ b/R/svyCreateTableOneJS.R @@ -65,7 +65,7 @@ svyCreateTableOne2 <- function(data, strata, vars, factorVars, includeNA = F, te res <- tableone::svyCreateTableOne( vars = vars, strata = strata, data = data, factorVars = factorVars, includeNA = includeNA, test = test, - smd = smd + smd = smd, addOverall = addOverall ) factor_vars <- res[["MetaData"]][["varFactors"]] @@ -85,7 +85,7 @@ svyCreateTableOne2 <- function(data, strata, vars, factorVars, includeNA = F, te } ptb1.res0 <- print(res0, showAllLevels = showAllLevels, printToggle = printToggle, quote = quote, varLabels = Labels, nonnormal = nonnormal, - catDigits = catDigits, contDigits = contDigits, minMax = minMax + catDigits = catDigits, contDigits = contDigits, minMax = minMax, addOverall = addOverall ) ptb1.rn <- rownames(ptb1.res0) ptb1.rn <- gsub("(mean (SD))", "", ptb1.rn, fixed = T) @@ -111,7 +111,7 @@ svyCreateTableOne2 <- function(data, strata, vars, factorVars, includeNA = F, te if (Labels & !is.null(labeldata)) { colname.group_var <- unlist(labeldata[get("variable") == strata, "val_label"]) - if (is.na(colname.group_var[1])) { + if (is.na(colname.group_var[1]) & addOverall) { colname.group_var[1] <- "Overall" } if (showAllLevels == T) { @@ -248,7 +248,7 @@ svyCreateTableOneJS <- function(vars, strata = NULL, strata2 = NULL, data, facto ptb1.list <- lapply(data.strata, svyCreateTableOne2, vars = vars, strata = strata2, factorVars = factorVars, includeNA = includeNA, test = test, smd = smd, showAllLevels = showAllLevels, printToggle = printToggle, quote = quote, Labels = F, nonnormal = nonnormal, - catDigits = catDigits, contDigits = contDigits, pDigits = pDigits, minMax = minMax, showpm = showpm, addOverall = addOverall + catDigits = catDigits, contDigits = contDigits, pDigits = pDigits, minMax = minMax, showpm = showpm, addOverall = F )