Skip to content

Commit 6b80edd

Browse files
committed
# ClinicoPath 0.0.2.0015
- 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
1 parent d28f55b commit 6b80edd

33 files changed

+2968
-122
lines changed

DESCRIPTION

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: ClinicoPath
33
Title: Analysis for Clinicopathological Research
4-
Version: 0.0.2.0013
5-
Date: 2020-06-12
4+
Version: 0.0.2.0015
5+
Date: 2020-06-28
66
Authors@R:
77
person(given = "Serdar",
88
family = "Balci",
@@ -51,7 +51,6 @@ Suggests:
5151
rpart,
5252
rpart.plot,
5353
plotROC,
54-
arsenal,
5554
easyalluvial,
5655
corrr,
5756
correlation,
@@ -70,13 +69,17 @@ Suggests:
7069
pkgnet,
7170
hrbrthemes,
7271
gtsummary,
73-
vctrs
72+
vctrs,
73+
retractcheck,
74+
RefManageR,
75+
rcrossref
7476
Remotes:
7577
ndphillips/FFTrees,
7678
easystats/report,
7779
spgarbet/tangram,
7880
cran/rmngb,
79-
mixOmicsTeam/mixOmics
81+
mixOmicsTeam/mixOmics,
82+
mayoverse/arsenal
8083
VignetteBuilder:
8184
knitr
8285
Encoding: UTF-8

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export(multisurvival)
2323
export(oddsratio)
2424
export(pairchi2)
2525
export(reportcat)
26+
export(retracted)
2627
export(roc)
2728
export(statsplot2)
2829
export(summarydata)

NEWS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# ClinicoPath 0.0.2.0015
2+
3+
- Added tangram statistical results
4+
- Added options to finalfit crosstables
5+
fixes: https://github.com/sbalci/ClinicoPathJamoviModule/issues/24
6+
fixes: https://github.com/jamovi/jamovi/issues/901
7+
fixes: https://github.com/ewenharrison/finalfit/issues/52
8+
9+
- Added experimental biblometrics functions
10+
- includes experimental changes
11+
12+
13+
14+
# ClinicoPath 0.0.2.0014
15+
16+
- Added footnote to arsenal crosstable
17+
18+
19+
120
# ClinicoPath 0.0.2.0012
221

322
- jjstatsplot is the wrapper functions for using ggstatsplot in jamovi.

R/00jmv.R

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,25 @@
311311
`year`=2020,
312312
`title`="hrbrthemes: Additional Themes, Theme Components and Utilities for 'ggplot2'.",
313313
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=hrbrthemes",
314-
`url`="https://CRAN.R-project.org/package=hrbrthemes"))
314+
`url`="https://CRAN.R-project.org/package=hrbrthemes"),
315+
`retractcheck`=list(
316+
`type`="software",
317+
`author`=NULL,
318+
`year`=NULL,
319+
`title`="",
320+
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
321+
`url`="https://CRAN.R-project.org/package="),
322+
`RefManageR`=list(
323+
`type`="software",
324+
`author`=NULL,
325+
`year`=NULL,
326+
`title`="",
327+
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
328+
`url`="https://CRAN.R-project.org/package="),
329+
`rcrossref`=list(
330+
`type`="software",
331+
`author`=NULL,
332+
`year`=NULL,
333+
`title`="",
334+
`publisher`="[R package]. Retrieved from https://CRAN.R-project.org/package=",
335+
`url`="https://CRAN.R-project.org/package="))

R/crosstable.b.R

Lines changed: 83 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
1313
.run = function() {
1414

1515

16+
17+
# Select Style ----
18+
19+
sty <- self$options$sty
20+
21+
22+
23+
1624
if (is.null(self$options$vars) || is.null(self$options$group)) {
1725

1826
# ToDo Message ----
1927

2028
todo <- glue::glue("
2129
<br>
22-
21:02
2330
<br>Welcome to ClinicoPath.<br>
2431
This tool will help you form a Cross Table.<br>
2532
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>
@@ -35,6 +42,23 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
3542
html <- self$results$todo
3643
html$setContent(todo)
3744

45+
46+
if (sty == "finalfit") {
47+
48+
49+
todo <- glue::glue("
50+
<br>
51+
<b>finalfit</b> uses
52+
<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>.
53+
"
54+
)
55+
56+
57+
html <- self$results$todo
58+
html$setContent(todo)
59+
60+
}
61+
3862
# Error Message ----
3963

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

6589

66-
# Select Style ----
67-
68-
sty <- self$options$sty
69-
7090

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

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

86106
tablearsenal <- summary(tablearsenal,
87107
text = 'html',
88-
pfootnote = TRUE
108+
pfootnote = 'html'
89109
)
90110

111+
# tablearsenal_output <- capture.output(tablearsenal)
91112

92-
tablearsenal <-
93-
kableExtra::kable(tablearsenal,
94-
format = "html",
95-
digits = 1,
96-
escape = FALSE
97-
)
113+
# self$results$tablearsenal_output$setContent(tablearsenal_output)
98114

99115

116+
# tablearsenal <-
117+
# kableExtra::kable(tablearsenal,
118+
# format = "html",
119+
# digits = 1,
120+
# escape = FALSE
121+
# )
122+
123+
124+
tablearsenal <- capture.output(tablearsenal)
125+
100126
self$results$tablestyle1$setContent(tablearsenal)
101127

102128

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

105131
# FinalFit ----
106132
# https://finalfit.org/articles/tables_gallery.html#cross-tables
133+
# https://finalfit.org/reference/summary_factorlist.html
107134

108135

109136
myvars <- jmvcore::composeTerm(components = self$options$vars)
@@ -118,17 +145,57 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
118145
.data = .,
119146
dependent = self$options$group,
120147
explanatory = myvars,
121-
# column = TRUE,
122148
total_col = TRUE,
123149
p = TRUE,
124150
add_dependent_label = TRUE,
125151
na_include = FALSE,
126-
na_to_p = FALSE
152+
na_to_p = FALSE,
153+
cont = self$options$cont,
154+
cont_range = TRUE,
155+
156+
157+
p_cont_para = "aov",
158+
p_cat = self$options$pcat,
159+
160+
161+
162+
163+
164+
165+
166+
167+
cont_nonpara = NULL,
168+
cont_cut = 5,
169+
dependent_label_prefix = "Dependent: ",
170+
dependent_label_suffix = "",
171+
row_totals_colname = "Total N",
172+
row_missing_colname = "Missing N",
173+
174+
175+
176+
177+
column = TRUE,
178+
orderbytotal = FALSE,
179+
digits = c(1, 1, 3, 1),
180+
na_include_dependent = FALSE,
181+
na_complete_cases = FALSE,
182+
fit_id = FALSE,
183+
add_col_totals = FALSE,
184+
include_col_totals_percent = TRUE,
185+
col_totals_rowname = NULL,
186+
col_totals_prefix = "",
187+
add_row_totals = FALSE,
188+
include_row_missing_col = TRUE
127189

128-
# catTest = catTestfisher
129190
) -> tablefinalfit
130191

131192

193+
194+
195+
196+
197+
198+
132199
tablefinalfit <- kableExtra::kable(tablefinalfit,
133200
format = "html",
134201
digits = 1,
@@ -183,6 +250,7 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
183250
mydata,
184251
transform=tangram::hmisc,
185252
id = "tbl3",
253+
test = TRUE,
186254
digits = 1,
187255
include_p = TRUE
188256
),
@@ -195,16 +263,9 @@ crosstableClass <- if (requireNamespace('jmvcore')) R6::R6Class(
195263

196264
self$results$tablestyle4$setContent(tabletangram)
197265
}
198-
199-
200-
201-
202266
# tableone ----
203267
# tab3 <- CreateTableOne(vars = myVars, strata = "trt" , data = pbc, factorVars = catVars)
204268

205-
206-
207-
208269
}
209270
})
210271
)

R/crosstable.h.R

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ crosstableOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
99
vars = NULL,
1010
group = NULL,
1111
sty = "nejm",
12-
excl = TRUE, ...) {
12+
excl = TRUE,
13+
cont = "mean",
14+
pcat = "chisq", ...) {
1315

1416
super$initialize(
1517
package='ClinicoPath',
@@ -43,22 +45,42 @@ crosstableOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
4345
"excl",
4446
excl,
4547
default=TRUE)
48+
private$..cont <- jmvcore::OptionList$new(
49+
"cont",
50+
cont,
51+
options=list(
52+
"mean",
53+
"median"),
54+
default="mean")
55+
private$..pcat <- jmvcore::OptionList$new(
56+
"pcat",
57+
pcat,
58+
options=list(
59+
"chisq",
60+
"fisher"),
61+
default="chisq")
4662

4763
self$.addOption(private$..vars)
4864
self$.addOption(private$..group)
4965
self$.addOption(private$..sty)
5066
self$.addOption(private$..excl)
67+
self$.addOption(private$..cont)
68+
self$.addOption(private$..pcat)
5169
}),
5270
active = list(
5371
vars = function() private$..vars$value,
5472
group = function() private$..group$value,
5573
sty = function() private$..sty$value,
56-
excl = function() private$..excl$value),
74+
excl = function() private$..excl$value,
75+
cont = function() private$..cont$value,
76+
pcat = function() private$..pcat$value),
5777
private = list(
5878
..vars = NA,
5979
..group = NA,
6080
..sty = NA,
61-
..excl = NA)
81+
..excl = NA,
82+
..cont = NA,
83+
..pcat = NA)
6284
)
6385

6486
crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
@@ -82,7 +104,9 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
82104
title="To Do",
83105
clearWith=list(
84106
"vars",
85-
"group")))
107+
"group",
108+
"cont",
109+
"pcat")))
86110
self$add(jmvcore::Html$new(
87111
options=options,
88112
name="tablestyle1",
@@ -98,7 +122,9 @@ crosstableResults <- if (requireNamespace('jmvcore')) R6::R6Class(
98122
title="`Cross Table - ${group}`",
99123
clearWith=list(
100124
"vars",
101-
"group"),
125+
"group",
126+
"cont",
127+
"pcat"),
102128
visible="(sty:finalfit)",
103129
refs="finalfit"))
104130
self$add(jmvcore::Html$new(
@@ -153,6 +179,8 @@ crosstableBase <- if (requireNamespace('jmvcore')) R6::R6Class(
153179
#' @param group variable in the column
154180
#' @param sty .
155181
#' @param excl .
182+
#' @param cont .
183+
#' @param pcat .
156184
#' @return A results object containing:
157185
#' \tabular{llllll}{
158186
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
@@ -168,7 +196,9 @@ crosstable <- function(
168196
vars,
169197
group,
170198
sty = "nejm",
171-
excl = TRUE) {
199+
excl = TRUE,
200+
cont = "mean",
201+
pcat = "chisq") {
172202

173203
if ( ! requireNamespace('jmvcore'))
174204
stop('crosstable requires jmvcore to be installed (restart may be required)')
@@ -187,7 +217,9 @@ crosstable <- function(
187217
vars = vars,
188218
group = group,
189219
sty = sty,
190-
excl = excl)
220+
excl = excl,
221+
cont = cont,
222+
pcat = pcat)
191223

192224
analysis <- crosstableClass$new(
193225
options = options,

R/multisurvival.b.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ multisurvivalClass <- if (requireNamespace('jmvcore')) R6::R6Class(
118118
finalfit::finalfit(.data = mydata,
119119
dependent = myformula,
120120
explanatory = formula2,
121-
# ,
121+
122122
# metrics = TRUE
123123
) -> tMultivariate
124124

0 commit comments

Comments
 (0)