From c094ba775d034ed728ec7c8eafebb89269dc32ae Mon Sep 17 00:00:00 2001 From: Andri Signorell Date: Wed, 21 Aug 2024 07:41:39 +0200 Subject: [PATCH] 0.99.56 --- DESCRIPTION | 4 ++-- NEWS | 6 +++--- R/Desc.R | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 689ca9149..87f09a47a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: DescTools Type: Package Title: Tools for Descriptive Statistics -Version: 0.99.55.4 -Date: 2024-08-19 +Version: 0.99.56 +Date: 2024-08-21 Authors@R: c( person("Andri", "Signorell", email = "andri@signorell.net", role = c("aut", "cre")), person("Ken" , "Aho", role = c("ctb")), diff --git a/NEWS b/NEWS index e49a3385b..2c9150b74 100644 --- a/NEWS +++ b/NEWS @@ -78,9 +78,9 @@ UPDATED FUNCTIONS: * Hodges-Lehman now uses long-longs instead of integers, allowing larger vectors. * AddMonthsYM() has been integrated in AddMonths(). Use AddMonths(as.ym(202402)) instead. - * The Desc() procedure now puts the response in columns instead in rows as up to now - in the case of two factor variables. So the resulting table is transposed compared - to before. + * The Desc() procedure now puts the response in columns instead in rows as up + to now in the case of two factor variables. So the resulting table is + transposed compared to before. * The Desc() procedure for 2x2 tables includes a confidence interval for the difference of proportions based on BinomDiffCI(..., method="mn"). diff --git a/R/Desc.R b/R/Desc.R index d4a5296e9..c69d7c770 100644 --- a/R/Desc.R +++ b/R/Desc.R @@ -1485,11 +1485,14 @@ calcDesc.bivar <- function(x, g, xname = NULL, gname = NULL, } -.LineSep <- function(sep, x){ +.LineSep <- function(sep, x, n=NULL){ + if(is.null(n)) + n <- getOption("width") - 2 + # define the separator, "-------..." if not given Coalesce( sep, x$sep, eval(parse(text=DescToolsOptions("linesep", default = NA))), - paste(rep("-", (getOption("width") - 2)), collapse = "") + paste(rep("-", n), collapse = "") ) } @@ -2011,12 +2014,12 @@ print.Desc.table <- function(x, digits = NULL, ...) { if ((x$verbose == "3") || (x$ttype == "t2x2")) { if (.has_color()) { cat(cli::col_silver(gettextf( - "\n----------\n%s %s%s conf. level\n", + "\n%s\n%s %s%s conf. level\n", .LineSep(n=10), DescToolsOptions("footnote")[1], x$conf.level * 100, "%" ))) } else { cat(gettextf( - "\n----------\n%s %s%s conf. level\n", + "\n%s\n%s %s%s conf. level\n", .LineSep(n=10), DescToolsOptions("footnote")[1], x$conf.level * 100, "%" )) }