R/pairchi2.h.R
# This file is automatically generated, you probably don't want to edit this
pairchi2Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"pairchi2Options",
inherit = jmvcore::Options,
public = list(
initialize = function(
row = NULL,
col = NULL, ...) {
super$initialize(
package="ClinicoPath",
name="pairchi2",
requiresData=TRUE,
...)
private$..row <- jmvcore::OptionVariable$new(
"row",
row)
private$..col <- jmvcore::OptionVariable$new(
"col",
col)
self$.addOption(private$..row)
self$.addOption(private$..col)
}),
active = list(
row = function() private$..row$value,
col = function() private$..col$value),
private = list(
..row = NA,
..col = NA)
)
pairchi2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"pairchi2Results",
inherit = jmvcore::Group,
active = list(
conftable = function() private$.items[["conftable"]],
chi2test = function() private$.items[["chi2test"]],
pairwise1 = function() private$.items[["pairwise1"]],
pairwise2 = function() private$.items[["pairwise2"]],
pairwise3 = function() private$.items[["pairwise3"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Pairwise Chi-Square Test",
refs=list(
"rmngb",
"RVAideMemoire",
"chisq.posthoc.test",
"ClinicoPathJamoviModule"))
self$add(jmvcore::Preformatted$new(
options=options,
name="conftable",
title="Confusion Table"))
self$add(jmvcore::Preformatted$new(
options=options,
name="chi2test",
title="Chi-Square Test"))
self$add(jmvcore::Preformatted$new(
options=options,
name="pairwise1",
title="Pairwise Chi-Square Test 1"))
self$add(jmvcore::Preformatted$new(
options=options,
name="pairwise2",
title="Pairwise Chi-Square Test 2"))
self$add(jmvcore::Preformatted$new(
options=options,
name="pairwise3",
title="Pairwise Chi-Square Test 3"))}))
pairchi2Base <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"pairchi2Base",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "pairchi2",
version = c(1,0,0),
options = options,
results = pairchi2Results$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Pairwise Chi-Square Test
#'
#'
#' @param data .
#' @param row .
#' @param col .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$conftable} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$chi2test} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$pairwise1} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$pairwise2} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$pairwise3} \tab \tab \tab \tab \tab a preformatted \cr
#' }
#'
#' @export
pairchi2 <- function(
data,
row,
col) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("pairchi2 requires jmvcore to be installed (restart may be required)")
if ( ! missing(row)) row <- jmvcore::resolveQuo(jmvcore::enquo(row))
if ( ! missing(col)) col <- jmvcore::resolveQuo(jmvcore::enquo(col))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(row), row, NULL),
`if`( ! missing(col), col, NULL))
options <- pairchi2Options$new(
row = row,
col = col)
analysis <- pairchi2Class$new(
options = options,
data = data)
analysis$run()
analysis$results
}