# This file is automatically generated, you probably don't want to edit this
jviolinOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jviolinOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
dep = NULL,
group = NULL,
col = NULL,
fill = NULL,
excl = FALSE,
flip = FALSE,
themex = "ipsum",
usexlabel = FALSE,
xlabel = "",
useylabel = FALSE,
ylabel = "", ...) {
super$initialize(
package="ClinicoPath",
name="jviolin",
requiresData=TRUE,
...)
private$..dep <- jmvcore::OptionVariable$new(
"dep",
dep)
private$..group <- jmvcore::OptionVariable$new(
"group",
group)
private$..col <- jmvcore::OptionVariable$new(
"col",
col)
private$..fill <- jmvcore::OptionVariable$new(
"fill",
fill)
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=FALSE)
private$..flip <- jmvcore::OptionBool$new(
"flip",
flip,
default=FALSE)
private$..themex <- jmvcore::OptionList$new(
"themex",
themex,
options=list(
"ipsum",
"grey",
"gray",
"bw",
"linedraw",
"light",
"dark",
"minimal",
"classic",
"void",
"test"),
default="ipsum")
private$..usexlabel <- jmvcore::OptionBool$new(
"usexlabel",
usexlabel,
default=FALSE)
private$..xlabel <- jmvcore::OptionString$new(
"xlabel",
xlabel,
default="")
private$..useylabel <- jmvcore::OptionBool$new(
"useylabel",
useylabel,
default=FALSE)
private$..ylabel <- jmvcore::OptionString$new(
"ylabel",
ylabel,
default="")
self$.addOption(private$..dep)
self$.addOption(private$..group)
self$.addOption(private$..col)
self$.addOption(private$..fill)
self$.addOption(private$..excl)
self$.addOption(private$..flip)
self$.addOption(private$..themex)
self$.addOption(private$..usexlabel)
self$.addOption(private$..xlabel)
self$.addOption(private$..useylabel)
self$.addOption(private$..ylabel)
}),
active = list(
dep = function() private$..dep$value,
group = function() private$..group$value,
col = function() private$..col$value,
fill = function() private$..fill$value,
excl = function() private$..excl$value,
flip = function() private$..flip$value,
themex = function() private$..themex$value,
usexlabel = function() private$..usexlabel$value,
xlabel = function() private$..xlabel$value,
useylabel = function() private$..useylabel$value,
ylabel = function() private$..ylabel$value),
private = list(
..dep = NA,
..group = NA,
..col = NA,
..fill = NA,
..excl = NA,
..flip = NA,
..themex = NA,
..usexlabel = NA,
..xlabel = NA,
..useylabel = NA,
..ylabel = NA)
)
jviolinResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jviolinResults",
inherit = jmvcore::Group,
active = list(
todo = function() private$.items[["todo"]],
plot = function() private$.items[["plot"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Violin Plot",
refs=list(
"ggplot2",
"RGraphGallery",
"hrbrthemes",
"ClinicoPathJamoviModule"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do",
clearWith=list(
"dep",
"group")))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="`${group} - {dep}`",
width=600,
height=450,
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
"dep",
"group",
"col",
"fill",
"excl",
"flip",
"themex",
"usexlabel",
"xlabel",
"useylabel",
"ylabel")))}))
jviolinBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jviolinBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "jviolin",
version = c(1,0,0),
options = options,
results = jviolinResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Violin Plot
#'
#'
#' @param data .
#' @param dep .
#' @param group .
#' @param col .
#' @param fill .
#' @param excl .
#' @param flip .
#' @param themex .
#' @param usexlabel .
#' @param xlabel .
#' @param useylabel .
#' @param ylabel .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' }
#'
#' @export
jviolin <- function(
data,
dep,
group,
col,
fill,
excl = FALSE,
flip = FALSE,
themex = "ipsum",
usexlabel = FALSE,
xlabel = "",
useylabel = FALSE,
ylabel = "") {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("jviolin 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(col)) col <- jmvcore::resolveQuo(jmvcore::enquo(col))
if ( ! missing(fill)) fill <- jmvcore::resolveQuo(jmvcore::enquo(fill))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(dep), dep, NULL),
`if`( ! missing(group), group, NULL),
`if`( ! missing(col), col, NULL),
`if`( ! missing(fill), fill, NULL))
options <- jviolinOptions$new(
dep = dep,
group = group,
col = col,
fill = fill,
excl = excl,
flip = flip,
themex = themex,
usexlabel = usexlabel,
xlabel = xlabel,
useylabel = useylabel,
ylabel = ylabel)
analysis <- jviolinClass$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.