diff --git a/DESCRIPTION b/DESCRIPTION index 393bb75..96b8c06 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: ClinicoPathDescriptives Title: Descriptives Functions for Clinicopathological Research -Version: 0.0.2.06 -Date: 2023-06-01 +Version: 0.0.2.07 +Date: 2023-07-02 Authors@R: person(given = "Serdar", family = "Balci", @@ -47,10 +47,10 @@ Imports: DiagrammeR, DiagrammeRsvg, rsvg, - shiny + shiny, + gtsummary Remotes: - nbarrowman/vtree@ffa53d4ea5050fa9b26918f4bb30595e91a0f489, - ddsjoberg/gtsummary@f43332fde6264ff95d092da644284dac739c4e17 + nbarrowman/vtree@ffa53d4ea5050fa9b26918f4bb30595e91a0f489 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/R/alluvial.h.R b/R/alluvial.h.R index 5b1dfe6..c736d88 100644 --- a/R/alluvial.h.R +++ b/R/alluvial.h.R @@ -8,7 +8,7 @@ alluvialOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( initialize = function( vars = NULL, condensationvar = NULL, - excl = TRUE, + excl = FALSE, marg = FALSE, fill = "first_variable", bin = "default", @@ -31,7 +31,7 @@ alluvialOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( private$..excl <- jmvcore::OptionBool$new( "excl", excl, - default=TRUE) + default=FALSE) private$..marg <- jmvcore::OptionBool$new( "marg", marg, @@ -205,7 +205,7 @@ alluvial <- function( data, vars, condensationvar, - excl = TRUE, + excl = FALSE, marg = FALSE, fill = "first_variable", bin = "default", diff --git a/R/crosstable.b.R b/R/crosstable.b.R index a2ac351..a653d7b 100644 --- a/R/crosstable.b.R +++ b/R/crosstable.b.R @@ -17,8 +17,6 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( sty <- self$options$sty - - if (is.null(self$options$vars) || is.null(self$options$group)) { # ToDo Message ---- @@ -39,27 +37,32 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( todo <- "" html <- self$results$todo html$setContent(todo) + } if (sty == "finalfit") { - - todo <- glue::glue(" + todo2 <- glue::glue("
finalfit uses aov (analysis of variance) or t.test for Welch two sample t-test. Note continuous non-parametric test is always Kruskal Wallis (kruskal.test) which in two-group setting is equivalent to Mann-Whitney U /Wilcoxon rank sum test. See full documentation here. " ) + } - html <- self$results$todo - html$setContent(todo) + if (sty != "finalfit") { + + todo2 <- glue::glue("") } + html <- self$results$todo2 + html$setContent(todo2) + # Error Message ---- - if (nrow(self$data) == 0) stop("Data contains no (complete) rows") + if (nrow(self$data) == 0) stop("Data contains no (complete) rows") # Prepare Data ---- @@ -149,41 +152,48 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( na_include = FALSE, na_to_p = FALSE, cont = self$options$cont, + cont_nonpara = NULL, + cont_cut = 5, cont_range = TRUE, - p_cont_para = "aov", p_cat = self$options$pcat, - - - - - - - - cont_nonpara = NULL, - cont_cut = 5, dependent_label_prefix = "Dependent: ", dependent_label_suffix = "", row_totals_colname = "Total N", row_missing_colname = "Missing N", - - column = TRUE, + orderbytotal = FALSE, - digits = c(1, 1, 3, 1), + digits = c(1, 1, 3, 1, 0), + + na_include_dependent = FALSE, na_complete_cases = FALSE, fit_id = FALSE, - add_col_totals = FALSE, + + na_to_prop = TRUE, + + + add_col_totals = TRUE, include_col_totals_percent = TRUE, col_totals_rowname = NULL, col_totals_prefix = "", add_row_totals = FALSE, - include_row_missing_col = TRUE + include_row_totals_percent = TRUE, + include_row_missing_col = TRUE, + + catTest = NULL, + weights = NULL + + + + + + ) -> tablefinalfit @@ -213,10 +223,22 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( tablegtsummary <- gtsummary::tbl_summary(data = mydata, - by = self$options$group) %>% - gtsummary::modify_header(stat_by = - gt::md("**{level}** N = {n} ({style_percent(p)}%)")) %>% + by = self$options$group, + statistic = list( + gtsummary::all_continuous() ~ "{mean} ({sd})", + gtsummary::all_categorical() ~ "{n} / {N} ({p}%)" + ), + digits = gtsummary::all_continuous() ~ 2, + missing_text = "(Missing)" + + ) %>% + gtsummary::modify_header( + update = gtsummary::all_stat_cols() ~ structure("**{level}** N = {n} ({style_percent(p)}%)", class = "from_markdown") + # stat_by = + # gt::md("**{level}** N = {n} ({style_percent(p)}%)") + ) %>% gtsummary::add_n(x = .) %>% + gtsummary::add_overall() %>% gtsummary::bold_labels(x = .) %>% gtsummary::add_p(x = ., pvalue_fun = @@ -225,6 +247,11 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( digits = 2) ) %>% gtsummary::add_q() + # %>% + # gtsummary::bold_labels() %>% + # gtsummary::bold_levels() %>% + # gtsummary::bold_p() + tablegtsummary <- gtsummary::as_kable_extra(tablegtsummary) @@ -284,5 +311,5 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class( # tab3 <- CreateTableOne(vars = myVars, strata = "trt" , data = pbc, factorVars = catVars) } - }) + ) ) diff --git a/R/crosstable.h.R b/R/crosstable.h.R index 1a11a1d..118dab7 100644 --- a/R/crosstable.h.R +++ b/R/crosstable.h.R @@ -9,7 +9,7 @@ crosstableOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( vars = NULL, group = NULL, sty = "nejm", - excl = TRUE, + excl = FALSE, cont = "mean", pcat = "chisq", ...) { @@ -44,7 +44,7 @@ crosstableOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( private$..excl <- jmvcore::OptionBool$new( "excl", excl, - default=TRUE) + default=FALSE) private$..cont <- jmvcore::OptionList$new( "cont", cont, @@ -88,6 +88,7 @@ crosstableResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( inherit = jmvcore::Group, active = list( todo = function() private$.items[["todo"]], + todo2 = function() private$.items[["todo2"]], tablestyle1 = function() private$.items[["tablestyle1"]], tablestyle2 = function() private$.items[["tablestyle2"]], tablestyle3 = function() private$.items[["tablestyle3"]], @@ -109,14 +110,26 @@ crosstableResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( "vars", "group", "cont", - "pcat"))) + "pcat", + "sty"))) + self$add(jmvcore::Html$new( + options=options, + name="todo2", + title="To Do", + clearWith=list( + "vars", + "group", + "cont", + "pcat", + "sty"))) self$add(jmvcore::Html$new( options=options, name="tablestyle1", title="`Cross Table - ${group}`", clearWith=list( "vars", - "group"), + "group", + "sty"), visible="(sty:arsenal)", refs="arsenal")) self$add(jmvcore::Html$new( @@ -127,7 +140,8 @@ crosstableResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( "vars", "group", "cont", - "pcat"), + "pcat", + "sty"), visible="(sty:finalfit)", refs="finalfit")) self$add(jmvcore::Html$new( @@ -136,7 +150,8 @@ crosstableResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( title="`Cross Table - ${group}`", clearWith=list( "vars", - "group"), + "group", + "sty"), visible="(sty:gtsummary)", refs="gtsummary")) self$add(jmvcore::Html$new( @@ -145,7 +160,8 @@ crosstableResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( title="`Cross Table - ${group}`", clearWith=list( "vars", - "group"), + "group", + "sty"), visible="(sty:nejm || sty:lancet || sty:hmisc)", refs="tangram"))})) @@ -188,6 +204,7 @@ crosstableBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( #' @return A results object containing: #' \tabular{llllll}{ #' \code{results$todo} \tab \tab \tab \tab \tab a html \cr +#' \code{results$todo2} \tab \tab \tab \tab \tab a html \cr #' \code{results$tablestyle1} \tab \tab \tab \tab \tab a html \cr #' \code{results$tablestyle2} \tab \tab \tab \tab \tab a html \cr #' \code{results$tablestyle3} \tab \tab \tab \tab \tab a html \cr @@ -200,7 +217,7 @@ crosstable <- function( vars, group, sty = "nejm", - excl = TRUE, + excl = FALSE, cont = "mean", pcat = "chisq") { diff --git a/R/tableone.h.R b/R/tableone.h.R index 2c106d4..7077937 100644 --- a/R/tableone.h.R +++ b/R/tableone.h.R @@ -8,7 +8,7 @@ tableoneOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( initialize = function( vars = NULL, sty = "t1", - excl = TRUE, ...) { + excl = FALSE, ...) { super$initialize( package="ClinicoPathDescriptives", @@ -31,7 +31,7 @@ tableoneOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( private$..excl <- jmvcore::OptionBool$new( "excl", excl, - default=TRUE) + default=FALSE) self$.addOption(private$..vars) self$.addOption(private$..sty) @@ -160,7 +160,7 @@ tableone <- function( data, vars, sty = "t1", - excl = TRUE) { + excl = FALSE) { if ( ! requireNamespace("jmvcore", quietly=TRUE)) stop("tableone requires jmvcore to be installed (restart may be required)") diff --git a/R/vartree.h.R b/R/vartree.h.R index 3cd3653..c0c9529 100644 --- a/R/vartree.h.R +++ b/R/vartree.h.R @@ -16,7 +16,7 @@ vartreeOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( follow = NULL, followLevel1 = NULL, followLevel2 = NULL, - excl = TRUE, + excl = FALSE, vp = TRUE, horizontal = FALSE, sline = TRUE, @@ -105,7 +105,7 @@ vartreeOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( private$..excl <- jmvcore::OptionBool$new( "excl", excl, - default=TRUE) + default=FALSE) private$..vp <- jmvcore::OptionBool$new( "vp", vp, @@ -360,7 +360,7 @@ vartree <- function( follow, followLevel1, followLevel2, - excl = TRUE, + excl = FALSE, vp = TRUE, horizontal = FALSE, sline = TRUE, diff --git a/jamovi/0000.yaml b/jamovi/0000.yaml index 8c03a36..f4eed31 100644 --- a/jamovi/0000.yaml +++ b/jamovi/0000.yaml @@ -1,12 +1,12 @@ --- title: Descriptives Functions for Clinicopathological Research name: ClinicoPathDescriptives -version: 0.0.2.06 +version: 0.0.2.07 jms: '1.0' authors: - Serdar Balci maintainer: Serdar Balci -date: '2023-06-01' +date: '2023-07-02' type: R description: >- Descriptives Functions for Clinicopathological Research Descriptive functions diff --git a/jamovi/alluvial.a.yaml b/jamovi/alluvial.a.yaml index 3a5fd8a..7fd0416 100644 --- a/jamovi/alluvial.a.yaml +++ b/jamovi/alluvial.a.yaml @@ -30,7 +30,7 @@ options: - name: excl title: Exclude missing (NA) type: Bool - default: true + default: false - name: marg title: Marginal plots diff --git a/jamovi/crosstable.a.yaml b/jamovi/crosstable.a.yaml index 289adc5..3c3f21f 100644 --- a/jamovi/crosstable.a.yaml +++ b/jamovi/crosstable.a.yaml @@ -59,7 +59,7 @@ options: - name: excl title: Exclude Missing (NA) type: Bool - default: true + default: false - name: cont diff --git a/jamovi/crosstable.r.yaml b/jamovi/crosstable.r.yaml index 35fb488..e3bc596 100644 --- a/jamovi/crosstable.r.yaml +++ b/jamovi/crosstable.r.yaml @@ -11,8 +11,15 @@ items: clearWith: - vars - group - - cont - - pcat + + - name: todo2 + title: To Do + type: Html + clearWith: + - vars + - group + - sty + # - name: tablearsenal_output # title: tablearsenal_output @@ -27,6 +34,7 @@ items: clearWith: - vars - group + - sty visible: (sty:arsenal) refs: arsenal @@ -39,6 +47,7 @@ items: - group - cont - pcat + - sty visible: (sty:finalfit) refs: finalfit @@ -49,6 +58,7 @@ items: clearWith: - vars - group + - sty visible: (sty:gtsummary) refs: gtsummary @@ -59,6 +69,7 @@ items: clearWith: - vars - group + - sty visible: (sty:nejm || sty:lancet || sty:hmisc) refs: tangram diff --git a/jamovi/tableone.a.yaml b/jamovi/tableone.a.yaml index b490eff..6547cff 100644 --- a/jamovi/tableone.a.yaml +++ b/jamovi/tableone.a.yaml @@ -54,7 +54,7 @@ options: - name: excl title: Exclude Missing (NA) type: Bool - default: true + default: false # - name: alllevels diff --git a/jamovi/vartree.a.yaml b/jamovi/vartree.a.yaml index 03b5378..4bebb2e 100644 --- a/jamovi/vartree.a.yaml +++ b/jamovi/vartree.a.yaml @@ -83,7 +83,7 @@ options: - name: excl title: Exclude Missing (NA) type: Bool - default: true + default: false - name: vp title: Valid Percentages diff --git a/man/alluvial.Rd b/man/alluvial.Rd index 3f663e6..beb180f 100644 --- a/man/alluvial.Rd +++ b/man/alluvial.Rd @@ -8,7 +8,7 @@ alluvial( data, vars, condensationvar, - excl = TRUE, + excl = FALSE, marg = FALSE, fill = "first_variable", bin = "default", diff --git a/man/crosstable.Rd b/man/crosstable.Rd index 9aeda7e..eaae228 100644 --- a/man/crosstable.Rd +++ b/man/crosstable.Rd @@ -9,7 +9,7 @@ crosstable( vars, group, sty = "nejm", - excl = TRUE, + excl = FALSE, cont = "mean", pcat = "chisq" ) diff --git a/man/tableone.Rd b/man/tableone.Rd index 690dfed..2c34a95 100644 --- a/man/tableone.Rd +++ b/man/tableone.Rd @@ -4,7 +4,7 @@ \alias{tableone} \title{Table One} \usage{ -tableone(data, vars, sty = "t1", excl = TRUE) +tableone(data, vars, sty = "t1", excl = FALSE) } \arguments{ \item{data}{The data as a data frame.} diff --git a/man/vartree.Rd b/man/vartree.Rd index 9b815b4..182dd5e 100644 --- a/man/vartree.Rd +++ b/man/vartree.Rd @@ -16,7 +16,7 @@ vartree( follow, followLevel1, followLevel2, - excl = TRUE, + excl = FALSE, vp = TRUE, horizontal = FALSE, sline = TRUE,