Skip to content

Commit

Permalink
experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalci committed Jun 18, 2020
1 parent a3ea707 commit 7687aed
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 88 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ jobs:
Rscript -e "if (!requireNamespace('tableone')) install.packages('tableone', type = 'source')"
Rscript -e "if (!requireNamespace('kableExtra')) install.packages('kableExtra', type = 'source')"
Rscript -e "if (!requireNamespace('caret')) install.packages('caret', type = 'source')"
Rscript -e "if (!requireNamespace('vtree')) install.packages('vtree', type = 'source')"
Rscript -e "if (!requireNamespace('correlation')) install.packages('correlation', type = 'source')"
Rscript -e "if (!requireNamespace('vtree')) remotes::install_github('nbarrowman/vtree')"
Rscript -e "if (!requireNamespace('flextable')) remotes::install_github('davidgohel/flextable')"
Rscript -e "if (!requireNamespace('hrbrthemes')) remotes::install_github('hrbrmstr/hrbrthemes')"
- name: "[Stage] Script"
Expand Down
12 changes: 9 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# ClinicoPath 0.0.2.0004

Using `spgarbet/[email protected]` until the bug is fixed.
# ClinicoPath 0.0.2.0012

- jjstatsplot is the wrapper functions for using ggstatsplot in jamovi.
- I thought it might be a nice separate module too. I have prepared it to ask opinions.
- Use attached `.jmo`files to install via side load in jamovi.
- Requires latest jamovi >=1.2.22 https://www.jamovi.org/download.html
- tangram error is fixed, but it does not reveal statistical test results.
- arsenal's footnote is not visible in Html output

# ClinicoPath 0.0.2.0004

Using `spgarbet/[email protected]` until the bug is fixed.


# ClinicoPath 0.0.2.0003
Expand Down
8 changes: 4 additions & 4 deletions R/ClinicoPath-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#' tests, and survival analysis with survival tables, survival plots,
#' and natural language summaries.
#'
#' @details The main functions are-
#' \itemize{
#' \item \code{\link[tableone]{tableone}} function to produce Table One.
#' }
# @details The main functions are-
# \itemize{
# \item \code{\link[tableone]{tableone}} function to produce Table One.
# }
#'
#' For more documentation, see the
#' \href{https://sbalci.github.io/ClinicoPathJamoviModule/}{Website}.
Expand Down
49 changes: 34 additions & 15 deletions R/crosstable.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
# tab3 <- CreateTableOne(vars = myVars, strata = "trt" , data = pbc, factorVars = catVars)


# Arsenal Table ----

if (sty == "arsenal") {

# Arsenal Table ----

tablearsenal <- arsenal::tableby(formula = formula,
data = mydata,
Expand All @@ -83,13 +83,18 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
digits.count = 1
)

tablearsenal <- summary(tablearsenal, text = 'html')
tablearsenal <- summary(tablearsenal,
text = 'html',
pfootnote = TRUE
)


tablearsenal <- kableExtra::kable(tablearsenal,
format = "html",
digits = 1,
escape = FALSE)
tablearsenal <-
kableExtra::kable(tablearsenal,
format = "html",
digits = 1,
escape = FALSE
)


self$results$tablestyle1$setContent(tablearsenal)
Expand All @@ -112,12 +117,14 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
finalfit::summary_factorlist(
.data = .,
dependent = self$options$group,
explanatory = myvars,
# column = TRUE,
total_col = TRUE,
p = TRUE,
add_dependent_label = TRUE,
na_include = FALSE
explanatory = myvars,
# column = TRUE,
total_col = TRUE,
p = TRUE,
add_dependent_label = TRUE,
na_include = FALSE,
na_to_p = FALSE

# catTest = catTestfisher
) -> tablefinalfit

Expand All @@ -135,6 +142,7 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(


# gtsummary ----

# http://www.danieldsjoberg.com/gtsummary/articles/gallery.html


Expand Down Expand Up @@ -174,7 +182,9 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
formula,
mydata,
transform=tangram::hmisc,
id = "tbl3"
id = "tbl3",
digits = 1,
include_p = TRUE
),
fragment = TRUE,
style = sty,
Expand All @@ -184,8 +194,17 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
id = "tbl3")

self$results$tablestyle4$setContent(tabletangram)
}




# tableone ----
# tab3 <- CreateTableOne(vars = myVars, strata = "trt" , data = pbc, factorVars = catVars)




}
}
}
})
)
78 changes: 62 additions & 16 deletions R/jjbarstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
direction = "independent",
excl = TRUE,
ratio = "",
results.subtitle = TRUE,
sample.size.label = TRUE,
label = "percentage",
perc.k = 0,
bf.message = TRUE,
sampling.plan = "indepMulti",
fixed.margin = "rows", ...) {
fixed.margin = "rows",
title = "",
results.subtitle = TRUE,
subtitle = "",
caption = "",
conf.level = 0.95, ...) {

super$initialize(
package='ClinicoPath',
Expand Down Expand Up @@ -73,10 +77,6 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"ratio",
ratio,
default="")
private$..results.subtitle <- jmvcore::OptionBool$new(
"results.subtitle",
results.subtitle,
default=TRUE)
private$..sample.size.label <- jmvcore::OptionBool$new(
"sample.size.label",
sample.size.label,
Expand Down Expand Up @@ -113,6 +113,28 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"rows",
"cols"),
default="rows")
private$..title <- jmvcore::OptionString$new(
"title",
title,
default="")
private$..results.subtitle <- jmvcore::OptionBool$new(
"results.subtitle",
results.subtitle,
default=TRUE)
private$..subtitle <- jmvcore::OptionString$new(
"subtitle",
subtitle,
default="")
private$..caption <- jmvcore::OptionString$new(
"caption",
caption,
default="")
private$..conf.level <- jmvcore::OptionNumber$new(
"conf.level",
conf.level,
default=0.95,
min=0,
max=1)

self$.addOption(private$..dep)
self$.addOption(private$..group)
Expand All @@ -121,13 +143,17 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
self$.addOption(private$..direction)
self$.addOption(private$..excl)
self$.addOption(private$..ratio)
self$.addOption(private$..results.subtitle)
self$.addOption(private$..sample.size.label)
self$.addOption(private$..label)
self$.addOption(private$..perc.k)
self$.addOption(private$..bf.message)
self$.addOption(private$..sampling.plan)
self$.addOption(private$..fixed.margin)
self$.addOption(private$..title)
self$.addOption(private$..results.subtitle)
self$.addOption(private$..subtitle)
self$.addOption(private$..caption)
self$.addOption(private$..conf.level)
}),
active = list(
dep = function() private$..dep$value,
Expand All @@ -137,13 +163,17 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
direction = function() private$..direction$value,
excl = function() private$..excl$value,
ratio = function() private$..ratio$value,
results.subtitle = function() private$..results.subtitle$value,
sample.size.label = function() private$..sample.size.label$value,
label = function() private$..label$value,
perc.k = function() private$..perc.k$value,
bf.message = function() private$..bf.message$value,
sampling.plan = function() private$..sampling.plan$value,
fixed.margin = function() private$..fixed.margin$value),
fixed.margin = function() private$..fixed.margin$value,
title = function() private$..title$value,
results.subtitle = function() private$..results.subtitle$value,
subtitle = function() private$..subtitle$value,
caption = function() private$..caption$value,
conf.level = function() private$..conf.level$value),
private = list(
..dep = NA,
..group = NA,
Expand All @@ -152,13 +182,17 @@ jjbarstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
..direction = NA,
..excl = NA,
..ratio = NA,
..results.subtitle = NA,
..sample.size.label = NA,
..label = NA,
..perc.k = NA,
..bf.message = NA,
..sampling.plan = NA,
..fixed.margin = NA)
..fixed.margin = NA,
..title = NA,
..results.subtitle = NA,
..subtitle = NA,
..caption = NA,
..conf.level = NA)
)

jjbarstatsResults <- if (requireNamespace('jmvcore')) R6::R6Class(
Expand Down Expand Up @@ -237,13 +271,17 @@ jjbarstatsBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' @param direction select measurement type (repeated or independent)
#' @param excl .
#' @param ratio .
#' @param results.subtitle .
#' @param sample.size.label .
#' @param label label
#' @param perc.k .
#' @param bf.message .
#' @param sampling.plan sampling.plan
#' @param fixed.margin fixed.margin
#' @param title .
#' @param results.subtitle .
#' @param subtitle .
#' @param caption .
#' @param conf.level .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
Expand All @@ -260,13 +298,17 @@ jjbarstats <- function(
direction = "independent",
excl = TRUE,
ratio = "",
results.subtitle = TRUE,
sample.size.label = TRUE,
label = "percentage",
perc.k = 0,
bf.message = TRUE,
sampling.plan = "indepMulti",
fixed.margin = "rows") {
fixed.margin = "rows",
title = "",
results.subtitle = TRUE,
subtitle = "",
caption = "",
conf.level = 0.95) {

if ( ! requireNamespace('jmvcore'))
stop('jjbarstats requires jmvcore to be installed (restart may be required)')
Expand Down Expand Up @@ -295,13 +337,17 @@ jjbarstats <- function(
direction = direction,
excl = excl,
ratio = ratio,
results.subtitle = results.subtitle,
sample.size.label = sample.size.label,
label = label,
perc.k = perc.k,
bf.message = bf.message,
sampling.plan = sampling.plan,
fixed.margin = fixed.margin)
fixed.margin = fixed.margin,
title = title,
results.subtitle = results.subtitle,
subtitle = subtitle,
caption = caption,
conf.level = conf.level)

analysis <- jjbarstatsClass$new(
options = options,
Expand Down
13 changes: 0 additions & 13 deletions R/tableone.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,6 @@ tableoneClass <- if (requireNamespace("jmvcore")) R6::R6Class("tableoneClass",

if (sty == "t1") {


# tableone

# showAllLevels = TRUE

# nonnormal = TRUE


# tab3 <- CreateTableOne(vars = myVars, strata = "trt" , data = pbc, factorVars = catVars)




mytable <- tableone::CreateTableOne(data = data)

self$results$tablestyle1$setContent(mytable)
Expand Down
Binary file modified data/histopathology.omv
Binary file not shown.
Loading

0 comments on commit 7687aed

Please sign in to comment.