# This file is automatically generated, you probably don't want to edit this
statsplot2Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"statsplot2Options",
inherit = jmvcore::Options,
public = list(
initialize = function(
dep = NULL,
group = NULL,
grvar = NULL,
direction = "independent",
distribution = "p",
alluvsty = "t1",
excl = FALSE,
originaltheme = FALSE, ...) {
super$initialize(
package="ClinicoPath",
name="statsplot2",
requiresData=TRUE,
...)
private$..dep <- jmvcore::OptionVariable$new(
"dep",
dep)
private$..group <- jmvcore::OptionVariable$new(
"group",
group)
private$..grvar <- jmvcore::OptionVariable$new(
"grvar",
grvar)
private$..direction <- jmvcore::OptionList$new(
"direction",
direction,
options=list(
"repeated",
"independent"),
default="independent")
private$..distribution <- jmvcore::OptionList$new(
"distribution",
distribution,
options=list(
"p",
"np"),
default="p")
private$..alluvsty <- jmvcore::OptionList$new(
"alluvsty",
alluvsty,
options=list(
"t1",
"t2"),
default="t1")
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=FALSE)
private$..originaltheme <- jmvcore::OptionBool$new(
"originaltheme",
originaltheme,
default=FALSE)
self$.addOption(private$..dep)
self$.addOption(private$..group)
self$.addOption(private$..grvar)
self$.addOption(private$..direction)
self$.addOption(private$..distribution)
self$.addOption(private$..alluvsty)
self$.addOption(private$..excl)
self$.addOption(private$..originaltheme)
}),
active = list(
dep = function() private$..dep$value,
group = function() private$..group$value,
grvar = function() private$..grvar$value,
direction = function() private$..direction$value,
distribution = function() private$..distribution$value,
alluvsty = function() private$..alluvsty$value,
excl = function() private$..excl$value,
originaltheme = function() private$..originaltheme$value),
private = list(
..dep = NA,
..group = NA,
..grvar = NA,
..direction = NA,
..distribution = NA,
..alluvsty = NA,
..excl = NA,
..originaltheme = NA)
)
statsplot2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"statsplot2Results",
inherit = jmvcore::Group,
active = list(
todo = function() private$.items[["todo"]],
text4 = function() private$.items[["text4"]],
plot = function() private$.items[["plot"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Variable Type Based Graphs and Plots",
refs=list(
"ggstatsplot",
"ggalluvial",
"easyalluvial",
"ClinicoPathJamoviModule"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do",
clearWith=list(
"dep",
"group",
"direction",
"distribution",
"excl",
"grvar",
"originaltheme")))
self$add(jmvcore::Preformatted$new(
options=options,
name="text4",
title="Explanation",
clearWith=list(
"dep",
"group",
"direction",
"distribution",
"excl",
"grvar",
"originaltheme")))
self$add(jmvcore::Image$new(
options=options,
title="Variable Type Based Graphs and Plots",
name="plot",
width=800,
height=600,
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"direction",
"distribution",
"alluvsty",
"excl",
"grvar",
"originaltheme")))}))
statsplot2Base <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"statsplot2Base",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "statsplot2",
version = c(1,0,0),
options = options,
results = statsplot2Results$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Graphs and Plots
#'
#' Function for Generating Plots and Graphs Based on Variable Types.
#'
#' @examples
#' \donttest{
#' # example will be added
#'}
#' @param data The data as a data frame.
#' @param dep .
#' @param group .
#' @param grvar .
#' @param direction select measurement type (repeated or independent)
#' @param distribution select distribution type (parametric or nonparametric)
#' @param alluvsty .
#' @param excl .
#' @param originaltheme .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text4} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' }
#'
#' @export
statsplot2 <- function(
data,
dep,
group,
grvar,
direction = "independent",
distribution = "p",
alluvsty = "t1",
excl = FALSE,
originaltheme = FALSE) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("statsplot2 requires jmvcore to be installed (restart may be required)")
if ( ! missing(dep)) dep <- jmvcore::resolveQuo(jmvcore::enquo(dep))
if ( ! missing(group)) group <- jmvcore::resolveQuo(jmvcore::enquo(group))
if ( ! missing(grvar)) grvar <- jmvcore::resolveQuo(jmvcore::enquo(grvar))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(dep), dep, NULL),
`if`( ! missing(group), group, NULL),
`if`( ! missing(grvar), grvar, NULL))
options <- statsplot2Options$new(
dep = dep,
group = group,
grvar = grvar,
direction = direction,
distribution = distribution,
alluvsty = alluvsty,
excl = excl,
originaltheme = originaltheme)
analysis <- statsplot2Class$new(
options = options,
data = data)
analysis$run()
analysis$results
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.