Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
sbalci committed Dec 26, 2023
1 parent fd4c82b commit fb4cb64
Show file tree
Hide file tree
Showing 45 changed files with 415 additions and 192 deletions.
2 changes: 1 addition & 1 deletion ClinicoPathDescriptives
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Package
Package: ClinicoPath
Title: Analysis for Clinicopathological Research
Version: 0.0.2.17
Date: 2023-12-24
Date: 2023-12-26
Authors@R:
person(given = "Serdar",
family = "Balci",
Expand Down
52 changes: 34 additions & 18 deletions R/jjbarstats.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,20 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))

if (length(self$options$dep) > 1) {
dep2 <- as.list(self$options$dep)
dep2_symbols <- purrr::map(dep2, rlang::sym)

plotlist <-
purrr::pmap(
.l = list(x = dep2,
# title = list(dep),
messages = TRUE),
.f = ggstatsplot::ggbarstats,
data = mydata,
y = !!group,
.l = list(
x = dep2_symbols,
messages = FALSE
),
.f = function(x, messages) {
ggstatsplot::ggbarstats(
data = mydata,
x = !!x,
messages = messages,
y = !!rlang::sym(group),

# paired = paired,
paired = FALSE,
Expand Down Expand Up @@ -233,6 +238,8 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))
# x = NULL,
# y = NULL
)
}
)

plot <- ggstatsplot::combine_plots(
plotlist = plotlist,
Expand Down Expand Up @@ -301,16 +308,17 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))

# originaltheme <- self$options$originaltheme

dep1 <- jmvcore::composeTerm(components = dep)
# dep1 <- jmvcore::composeTerm(components = dep)

group <- jmvcore::composeTerm(components = group)
# group <- jmvcore::composeTerm(components = group)



# grouped_ggbarstats ----
# https://indrajeetpatil.github.io/ggstatsplot/reference/grouped_ggbarstats.html


dep1 <- self$options$dep

grvar <- self$options$grvar

Expand All @@ -319,9 +327,9 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))
if (length(self$options$dep) == 1) {
plot2 <- ggstatsplot::grouped_ggbarstats(
data = mydata,
x = !!dep1,
y = !!group,
grouping.var = !!grvar,
x = !!rlang::sym(dep1),
y = !!rlang::sym(group),
grouping.var = !!rlang::sym(grvar),

# paired = paired,
paired = FALSE,
Expand Down Expand Up @@ -351,18 +359,24 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))
# dep > 1 ----

if (length(self$options$dep) > 1) {

dep2 <- as.list(self$options$dep)

dep2_symbols <- purrr::map(dep2, rlang::sym)

plotlist <-
purrr::pmap(
.l = list(x = dep2,
# title = list(dep),
messages = TRUE),
.f = ggstatsplot::grouped_ggbarstats,
.l = list(
x = dep2_symbols,
messages = FALSE
),
.f = function(x, messages) {
ggstatsplot::grouped_ggbarstats(
data = mydata,
x = !!x,
messages = messages,

y = !!group,
grouping.var = !!grvar,
y = !!rlang::sym(group),
grouping.var = !!rlang::sym(grvar),

# paired = paired,

Expand All @@ -385,6 +399,8 @@ jjbarstatsClass <- if (requireNamespace('jmvcore'))
# ggtheme = ggtheme,
# ggstatsplot.layer = originaltheme
)
}
)

plot2 <- ggstatsplot::combine_plots(
plotlist = plotlist,
Expand Down
6 changes: 3 additions & 3 deletions R/jjbarstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jjbarstatsOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
dep = NULL,
group = NULL,
grvar = NULL,
excl = TRUE,
excl = FALSE,
typestatistics = "parametric",
pairwisecomparisons = TRUE,
pairwisedisplay = "significant",
Expand Down Expand Up @@ -49,7 +49,7 @@ jjbarstatsOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=TRUE)
default=FALSE)
private$..typestatistics <- jmvcore::OptionList$new(
"typestatistics",
typestatistics,
Expand Down Expand Up @@ -217,7 +217,7 @@ jjbarstats <- function(
dep,
group,
grvar,
excl = TRUE,
excl = FALSE,
typestatistics = "parametric",
pairwisecomparisons = TRUE,
pairwisedisplay = "significant",
Expand Down
6 changes: 3 additions & 3 deletions R/jjbarstats2.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jjbarstats2Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class
group = NULL,
grvar = NULL,
direction = "independent",
excl = TRUE,
excl = FALSE,
originaltheme = FALSE, ...) {

super$initialize(
Expand Down Expand Up @@ -38,7 +38,7 @@ jjbarstats2Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=TRUE)
default=FALSE)
private$..originaltheme <- jmvcore::OptionBool$new(
"originaltheme",
originaltheme,
Expand Down Expand Up @@ -182,7 +182,7 @@ jjbarstats2 <- function(
group,
grvar,
direction = "independent",
excl = TRUE,
excl = FALSE,
originaltheme = FALSE) {

if ( ! requireNamespace("jmvcore", quietly=TRUE))
Expand Down
81 changes: 42 additions & 39 deletions R/jjbetweenstats.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
self$results$plot2$setSize(1200, deplen * 450)

}
,

,
.run = function() {

# Initial Message ----
Expand Down Expand Up @@ -57,7 +57,6 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
}
}


,
.plot = function(image, ggtheme, theme, ...) {

Expand Down Expand Up @@ -225,15 +224,20 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(

if (length(self$options$dep) > 1) {
dep2 <- as.list(self$options$dep)
dep2_symbols <- purrr::map(dep2, rlang::sym)

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

.f = function(y, messages) {
ggstatsplot::ggbetweenstats(
data = mydata,
y = !!y,
messages = messages,
x = !!rlang::sym(group),
, type = typestatistics
, ggtheme = ggtheme
, ggstatsplot.layer = originaltheme
Expand All @@ -247,6 +251,8 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(



)
}
)

plot <- ggstatsplot::combine_plots(
Expand All @@ -255,19 +261,14 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
)



}




# Print Plot ----

print(plot)
TRUE

}

}

,
.plot2 = function(image, ggtheme, theme, ...) {
Expand Down Expand Up @@ -356,9 +357,9 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(



dep <- jmvcore::composeTerm(components = dep)
# dep <- jmvcore::composeTerm(components = dep)

group <- jmvcore::composeTerm(components = group)
# group <- jmvcore::composeTerm(components = group)



Expand All @@ -375,9 +376,9 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(

plot2 <- ggstatsplot::grouped_ggbetweenstats(
data = mydata,
x = !!group,
y = !! dep,
grouping.var = !!grvar
x = !!rlang::sym(group),
y = !!rlang::sym(dep),
grouping.var = !!rlang::sym(grvar)
, type = typestatistics
, ggtheme = ggtheme
, ggstatsplot.layer = originaltheme
Expand All @@ -397,17 +398,27 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
# dep > 1 ----

if (length(self$options$dep) > 1) {

dep2 <- as.list(self$options$dep)
dep2_symbols <- purrr::map(dep2, rlang::sym)

plotlist <-
purrr::pmap(
.l = list(y = dep2,
# title = list(dep),
messages = FALSE),
.f = ggstatsplot::grouped_ggbetweenstats,
.l = list(
y = dep2_symbols,
messages = FALSE
),
.f = function(y, messages) {
ggstatsplot::grouped_ggbetweenstats(

data = mydata,
x = !!group,
grouping.var = !!grvar
y = !!y,
messages = messages,



x = !!rlang::sym(group),
grouping.var = !!rlang::sym(grvar)
, type = typestatistics
, ggtheme = ggtheme
, ggstatsplot.layer = originaltheme
Expand All @@ -417,34 +428,26 @@ jjbetweenstatsClass <- if (requireNamespace('jmvcore')) R6::R6Class(
, p.adjust.method = padjustmethod










)
}
)


plot2 <- ggstatsplot::combine_plots(
plotlist = plotlist,
plotgrid.args = list(ncol = 1)
)

}



# Print Plot ----

print(plot2)
TRUE

}


}

}

)

)
6 changes: 3 additions & 3 deletions R/jjbetweenstats.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jjbetweenstatsOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
dep = NULL,
group = NULL,
grvar = NULL,
excl = TRUE,
excl = FALSE,
typestatistics = "parametric",
pairwisecomparisons = TRUE,
pairwisedisplay = "significant",
Expand Down Expand Up @@ -50,7 +50,7 @@ jjbetweenstatsOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=TRUE)
default=FALSE)
private$..typestatistics <- jmvcore::OptionList$new(
"typestatistics",
typestatistics,
Expand Down Expand Up @@ -229,7 +229,7 @@ jjbetweenstats <- function(
dep,
group,
grvar = NULL,
excl = TRUE,
excl = FALSE,
typestatistics = "parametric",
pairwisecomparisons = TRUE,
pairwisedisplay = "significant",
Expand Down
2 changes: 1 addition & 1 deletion R/jjcorrmat.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jjcorrmatClass <- if (requireNamespace('jmvcore')) R6::R6Class(
data = mydata,
cor.vars = myvars,
cor.vars.names = NULL,
grouping.var = !!grvar,
grouping.var = !!rlang::sym(grvar),
title.prefix = NULL,
output = "plot",
plotgrid.args = list(),
Expand Down
Loading

0 comments on commit fb4cb64

Please sign in to comment.