Skip to content

Commit

Permalink
# ClinicoPath 0.0.2.0015
Browse files Browse the repository at this point in the history
- Added tangram statistical results
- Added options to finalfit crosstables
fixes: #24
fixes: jamovi/jamovi#901
fixes: ewenharrison/finalfit#52

- Added experimental biblometrics functions
- includes experimental changes
  • Loading branch information
sbalci committed Jun 28, 2020
1 parent d28f55b commit 6b80edd
Show file tree
Hide file tree
Showing 33 changed files with 2,968 additions and 122 deletions.
13 changes: 8 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: ClinicoPath
Title: Analysis for Clinicopathological Research
Version: 0.0.2.0013
Date: 2020-06-12
Version: 0.0.2.0015
Date: 2020-06-28
Authors@R:
person(given = "Serdar",
family = "Balci",
Expand Down Expand Up @@ -51,7 +51,6 @@ Suggests:
rpart,
rpart.plot,
plotROC,
arsenal,
easyalluvial,
corrr,
correlation,
Expand All @@ -70,13 +69,17 @@ Suggests:
pkgnet,
hrbrthemes,
gtsummary,
vctrs
vctrs,
retractcheck,
RefManageR,
rcrossref
Remotes:
ndphillips/FFTrees,
easystats/report,
spgarbet/tangram,
cran/rmngb,
mixOmicsTeam/mixOmics
mixOmicsTeam/mixOmics,
mayoverse/arsenal
VignetteBuilder:
knitr
Encoding: UTF-8
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export(multisurvival)
export(oddsratio)
export(pairchi2)
export(reportcat)
export(retracted)
export(roc)
export(statsplot2)
export(summarydata)
Expand Down
19 changes: 19 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# ClinicoPath 0.0.2.0015

- Added tangram statistical results
- Added options to finalfit crosstables
fixes: https://github.com/sbalci/ClinicoPathJamoviModule/issues/24
fixes: https://github.com/jamovi/jamovi/issues/901
fixes: https://github.com/ewenharrison/finalfit/issues/52

- Added experimental biblometrics functions
- includes experimental changes



# ClinicoPath 0.0.2.0014

- Added footnote to arsenal crosstable



# ClinicoPath 0.0.2.0012

- jjstatsplot is the wrapper functions for using ggstatsplot in jamovi.
Expand Down
23 changes: 22 additions & 1 deletion R/00jmv.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,25 @@
`year`=2020,
`title`="hrbrthemes: Additional Themes, Theme Components and Utilities for 'ggplot2'.",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=hrbrthemes",
`url`="https://CRAN.R-project.org/package=hrbrthemes"))
`url`="https://CRAN.R-project.org/package=hrbrthemes"),
`retractcheck`=list(
`type`="software",
`author`=NULL,
`year`=NULL,
`title`="",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
`url`="https://CRAN.R-project.org/package="),
`RefManageR`=list(
`type`="software",
`author`=NULL,
`year`=NULL,
`title`="",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
`url`="https://CRAN.R-project.org/package="),
`rcrossref`=list(
`type`="software",
`author`=NULL,
`year`=NULL,
`title`="",
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
`url`="https://CRAN.R-project.org/package="))
105 changes: 83 additions & 22 deletions R/crosstable.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
.run = function() {



# Select Style ----

sty <- self$options$sty




if (is.null(self$options$vars) || is.null(self$options$group)) {

# ToDo Message ----

todo <- glue::glue("
<br>
21:02
<br>Welcome to ClinicoPath.<br>
This tool will help you form a Cross Table.<br>
The functions select hypothesis tests automatically. You may see different results with different tables. Please verify your data distribution and appropriateness of the test accordingly. You may find Statkat module useful.<br>
Expand All @@ -35,6 +42,23 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
html <- self$results$todo
html$setContent(todo)


if (sty == "finalfit") {


todo <- glue::glue("
<br>
<b>finalfit</b> uses
<em>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</em>. See full documentation <a href= 'https://finalfit.org/reference/summary_factorlist.html'>here</a>.
"
)


html <- self$results$todo
html$setContent(todo)

}

# Error Message ----

if (nrow(self$data) == 0) stop("Data contains no (complete) rows")
Expand Down Expand Up @@ -63,10 +87,6 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
if (excl) {mydata <- jmvcore::naOmit(mydata)}


# Select Style ----

sty <- self$options$sty


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

Expand All @@ -85,25 +105,32 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(

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

# tablearsenal_output <- capture.output(tablearsenal)

tablearsenal <-
kableExtra::kable(tablearsenal,
format = "html",
digits = 1,
escape = FALSE
)
# self$results$tablearsenal_output$setContent(tablearsenal_output)


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


tablearsenal <- capture.output(tablearsenal)

self$results$tablestyle1$setContent(tablearsenal)


} else if (sty == "finalfit") {

# FinalFit ----
# https://finalfit.org/articles/tables_gallery.html#cross-tables
# https://finalfit.org/reference/summary_factorlist.html


myvars <- jmvcore::composeTerm(components = self$options$vars)
Expand All @@ -118,17 +145,57 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
.data = .,
dependent = self$options$group,
explanatory = myvars,
# column = TRUE,
total_col = TRUE,
p = TRUE,
add_dependent_label = TRUE,
na_include = FALSE,
na_to_p = FALSE
na_to_p = FALSE,
cont = self$options$cont,
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),
na_include_dependent = FALSE,
na_complete_cases = FALSE,
fit_id = FALSE,
add_col_totals = FALSE,
include_col_totals_percent = TRUE,
col_totals_rowname = NULL,
col_totals_prefix = "",
add_row_totals = FALSE,
include_row_missing_col = TRUE

# catTest = catTestfisher
) -> tablefinalfit








tablefinalfit <- kableExtra::kable(tablefinalfit,
format = "html",
digits = 1,
Expand Down Expand Up @@ -183,6 +250,7 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
mydata,
transform=tangram::hmisc,
id = "tbl3",
test = TRUE,
digits = 1,
include_p = TRUE
),
Expand All @@ -195,16 +263,9 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(

self$results$tablestyle4$setContent(tabletangram)
}




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




}
})
)
46 changes: 39 additions & 7 deletions R/crosstable.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ crosstableOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
vars = NULL,
group = NULL,
sty = "nejm",
excl = TRUE, ...) {
excl = TRUE,
cont = "mean",
pcat = "chisq", ...) {

super$initialize(
package='ClinicoPath',
Expand Down Expand Up @@ -43,22 +45,42 @@ crosstableOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"excl",
excl,
default=TRUE)
private$..cont <- jmvcore::OptionList$new(
"cont",
cont,
options=list(
"mean",
"median"),
default="mean")
private$..pcat <- jmvcore::OptionList$new(
"pcat",
pcat,
options=list(
"chisq",
"fisher"),
default="chisq")

self$.addOption(private$..vars)
self$.addOption(private$..group)
self$.addOption(private$..sty)
self$.addOption(private$..excl)
self$.addOption(private$..cont)
self$.addOption(private$..pcat)
}),
active = list(
vars = function() private$..vars$value,
group = function() private$..group$value,
sty = function() private$..sty$value,
excl = function() private$..excl$value),
excl = function() private$..excl$value,
cont = function() private$..cont$value,
pcat = function() private$..pcat$value),
private = list(
..vars = NA,
..group = NA,
..sty = NA,
..excl = NA)
..excl = NA,
..cont = NA,
..pcat = NA)
)

crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
Expand All @@ -82,7 +104,9 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
title="To Do",
clearWith=list(
"vars",
"group")))
"group",
"cont",
"pcat")))
self$add(jmvcore::Html$new(
options=options,
name="tablestyle1",
Expand All @@ -98,7 +122,9 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
title="`Cross Table - ${group}`",
clearWith=list(
"vars",
"group"),
"group",
"cont",
"pcat"),
visible="(sty:finalfit)",
refs="finalfit"))
self$add(jmvcore::Html$new(
Expand Down Expand Up @@ -153,6 +179,8 @@ crosstableBase <- if (requireNamespace('jmvcore')) R6::R6Class(
#' @param group variable in the column
#' @param sty .
#' @param excl .
#' @param cont .
#' @param pcat .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
Expand All @@ -168,7 +196,9 @@ crosstable <- function(
vars,
group,
sty = "nejm",
excl = TRUE) {
excl = TRUE,
cont = "mean",
pcat = "chisq") {

if ( ! requireNamespace('jmvcore'))
stop('crosstable requires jmvcore to be installed (restart may be required)')
Expand All @@ -187,7 +217,9 @@ crosstable <- function(
vars = vars,
group = group,
sty = sty,
excl = excl)
excl = excl,
cont = cont,
pcat = pcat)

analysis <- crosstableClass$new(
options = options,
Expand Down
2 changes: 1 addition & 1 deletion R/multisurvival.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ multisurvivalClass <- if (requireNamespace('jmvcore')) R6::R6Class(
finalfit::finalfit(.data = mydata,
dependent = myformula,
explanatory = formula2,
# ,

# metrics = TRUE
) -> tMultivariate

Expand Down
Loading

0 comments on commit 6b80edd

Please sign in to comment.