Skip to content

Commit

Permalink
# ClinicoPath 0.0.2.0038
Browse files Browse the repository at this point in the history
- fixes #20
  • Loading branch information
sbalci committed Aug 23, 2020
1 parent fd6651f commit 8531486
Show file tree
Hide file tree
Showing 41 changed files with 1,460 additions and 425 deletions.
4 changes: 2 additions & 2 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.0037
Date: 2020-08-22
Version: 0.0.2.0039
Date: 2020-08-23
Authors@R:
person(given = "Serdar",
family = "Balci",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export(jjhistostats)
export(jjpiestats)
export(jjscatterstats)
export(jjwithinstats)
export(jjwithinstats2)
export(jviolin)
export(kmeans)
export(linReg)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# ClinicoPath 0.0.2.0039


# ClinicoPath 0.0.2.0038

- fixes https://github.com/sbalci/ClinicoPathJamoviModule/issues/20

# ClinicoPath 0.0.2.0037

- added Survival Analysis for Continuous Explanatory
Expand Down
2 changes: 2 additions & 0 deletions R/jjbarstats.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))

self$results$plot$setSize(400, deplen * 300)

self$results$plot2$setSize(800, deplen * 300)

}
,

Expand Down
30 changes: 8 additions & 22 deletions R/jjbarstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,44 +86,30 @@ jjbarstatsResults <- if (requireNamespace('jmvcore')) R6::R6Class(
title="Bar Charts",
refs=list(
"ggplot2",
"ggstatsplot"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do",
"ggstatsplot"),
clearWith=list(
"dep",
"group",
"grvar",
"direction",
"originaltheme")))
"originaltheme"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do"))
self$add(jmvcore::Image$new(
options=options,
name="plot2",
title="Bar Chart Splitted",
width=800,
height=600,
title="`Bar Chart Splitted by {grvar}`",
renderFun=".plot2",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"grvar",
"direction",
"originaltheme"),
visible="(grvar)"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Bar Chart",
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"grvar",
"direction",
"originaltheme")))}))
requiresData=TRUE))}))

jjbarstatsBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"jjbarstatsBase",
Expand Down
81 changes: 79 additions & 2 deletions R/jjbetweenstats.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jjbetweenstatsBase,
private = list(

# init ----

.init = function() {
deplen <- length(self$options$dep)

self$results$plot$setSize(400, deplen * 300)

self$results$plot2$setSize(800, deplen * 300)

}
,


.run = function() {

# Initial Message ----
Expand Down Expand Up @@ -133,7 +146,9 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
# ggbetweenstats ----
# https://indrajeetpatil.github.io/ggstatsplot/reference/ggbetweenstats.html

# dep == 1 ----

if (length(self$options$dep) == 1) {
plot <- ggstatsplot::ggbetweenstats(
data = mydata,
x = !!group,
Expand All @@ -145,6 +160,39 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(

)

}



# dep > 1 ----

if (length(self$options$dep) > 1) {
dep2 <- as.list(self$options$dep)

plotlist <-
purrr::pmap(
.l = list(y = dep2,
# title = list(dep),
messages = FALSE),
.f = ggstatsplot::ggbetweenstats,
data = mydata,
x = !!group,
# ,
# type = distribution
, ggtheme = ggtheme
, ggstatsplot.layer = originaltheme

)

plot <- ggstatsplot::combine_plots(plotlist = plotlist,
nrow = length(self$options$dep))



}




# Print Plot ----

Expand Down Expand Up @@ -241,9 +289,11 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
# https://indrajeetpatil.github.io/ggstatsplot/reference/grouped_ggbetweenstats.html


if ( !is.null(self$options$grvar) ) {
# dep = 1 ----

grvar <- self$options$grvar

grvar <- self$options$grvar
if (length(self$options$dep) == 1) {

plot2 <- ggstatsplot::grouped_ggbetweenstats(
data = mydata,
Expand All @@ -257,6 +307,33 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(

}


# dep > 1 ----

if (length(self$options$dep) > 1) {
dep2 <- as.list(self$options$dep)

plotlist <-
purrr::pmap(
.l = list(y = dep2,
# title = list(dep),
messages = FALSE),
.f = ggstatsplot::grouped_ggbetweenstats,
data = mydata,
x = !!group,
grouping.var = !!grvar
, ggtheme = ggtheme
, ggstatsplot.layer = originaltheme

)

plot2 <- ggstatsplot::combine_plots(plotlist = plotlist,
ncol = 1)

}



# Print Plot ----

print(plot2)
Expand Down
36 changes: 10 additions & 26 deletions R/jjbetweenstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jjbetweenstatsOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
requiresData=TRUE,
...)

private$..dep <- jmvcore::OptionVariable$new(
private$..dep <- jmvcore::OptionVariables$new(
"dep",
dep,
suggested=list(
Expand Down Expand Up @@ -85,45 +85,29 @@ jjbetweenstatsResults <- if (requireNamespace('jmvcore')) R6::R6Class(
title="Violin Plots to Compare Between Groups",
refs=list(
"ggplot2",
"ggstatsplot"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do",
"ggstatsplot"),
clearWith=list(
"dep",
"group",
"grvar",
"originaltheme")))
"originaltheme"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do"))
self$add(jmvcore::Image$new(
options=options,
name="plot2",
title="`${group} - {dep} by {grvar}`",
width=800,
height=600,
title="`Violin Plot by ${grvar}`",
renderFun=".plot2",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"grvar",
"direction",
"originaltheme"),
visible="(grvar)"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="`${group} - {dep}`",
width=800,
height=600,
title="Violin Plot",
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"grvar",
"direction",
"originaltheme")))}))
requiresData=TRUE))}))

jjbetweenstatsBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"jjbetweenstatsBase",
Expand Down
6 changes: 3 additions & 3 deletions R/jjdotplotstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jjdotplotstatsResults <- if (requireNamespace('jmvcore')) R6::R6Class(
name="plot2",
title="`${group} - {dep} by {grvar}`",
width=800,
height=600,
height=300,
renderFun=".plot2",
requiresData=TRUE,
clearWith=list(
Expand All @@ -115,8 +115,8 @@ jjdotplotstatsResults <- if (requireNamespace('jmvcore')) R6::R6Class(
options=options,
name="plot",
title="`${group} - {dep}`",
width=800,
height=600,
width=400,
height=300,
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
Expand Down
Loading

0 comments on commit 8531486

Please sign in to comment.