# This file is automatically generated, you probably don't want to edit this
jjridgestatsOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jjridgestatsOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
dep = NULL,
group = NULL,
plotStyle = "density",
scaling = 1,
bandwidth = 1,
binwidth = 1,
fill = TRUE,
colorscheme = "viridis",
customColor = "#4682B4",
themeChoice = "minimal",
legendPosition = "none",
mytitle = "",
xtitle = "",
ytitle = "", ...) {
super$initialize(
package="ClinicoPath",
name="jjridgestats",
requiresData=TRUE,
...)
private$..dep <- jmvcore::OptionVariable$new(
"dep",
dep,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..group <- jmvcore::OptionVariable$new(
"group",
group,
suggested=list(
"ordinal",
"nominal"),
permitted=list(
"factor"))
private$..plotStyle <- jmvcore::OptionList$new(
"plotStyle",
plotStyle,
options=list(
"density",
"histogram",
"gradient"),
default="density")
private$..scaling <- jmvcore::OptionNumber$new(
"scaling",
scaling,
min=0.1,
max=10,
default=1)
private$..bandwidth <- jmvcore::OptionNumber$new(
"bandwidth",
bandwidth,
min=0.1,
max=10,
default=1)
private$..binwidth <- jmvcore::OptionNumber$new(
"binwidth",
binwidth,
min=0.1,
default=1)
private$..fill <- jmvcore::OptionBool$new(
"fill",
fill,
default=TRUE)
private$..colorscheme <- jmvcore::OptionList$new(
"colorscheme",
colorscheme,
options=list(
"viridis",
"plasma",
"magma",
"blues",
"custom"),
default="viridis")
private$..customColor <- jmvcore::OptionString$new(
"customColor",
customColor,
default="#4682B4")
private$..themeChoice <- jmvcore::OptionList$new(
"themeChoice",
themeChoice,
options=list(
"minimal",
"classic",
"dark"),
default="minimal")
private$..legendPosition <- jmvcore::OptionList$new(
"legendPosition",
legendPosition,
options=list(
"none",
"right",
"bottom"),
default="none")
private$..mytitle <- jmvcore::OptionString$new(
"mytitle",
mytitle,
default="")
private$..xtitle <- jmvcore::OptionString$new(
"xtitle",
xtitle,
default="")
private$..ytitle <- jmvcore::OptionString$new(
"ytitle",
ytitle,
default="")
self$.addOption(private$..dep)
self$.addOption(private$..group)
self$.addOption(private$..plotStyle)
self$.addOption(private$..scaling)
self$.addOption(private$..bandwidth)
self$.addOption(private$..binwidth)
self$.addOption(private$..fill)
self$.addOption(private$..colorscheme)
self$.addOption(private$..customColor)
self$.addOption(private$..themeChoice)
self$.addOption(private$..legendPosition)
self$.addOption(private$..mytitle)
self$.addOption(private$..xtitle)
self$.addOption(private$..ytitle)
}),
active = list(
dep = function() private$..dep$value,
group = function() private$..group$value,
plotStyle = function() private$..plotStyle$value,
scaling = function() private$..scaling$value,
bandwidth = function() private$..bandwidth$value,
binwidth = function() private$..binwidth$value,
fill = function() private$..fill$value,
colorscheme = function() private$..colorscheme$value,
customColor = function() private$..customColor$value,
themeChoice = function() private$..themeChoice$value,
legendPosition = function() private$..legendPosition$value,
mytitle = function() private$..mytitle$value,
xtitle = function() private$..xtitle$value,
ytitle = function() private$..ytitle$value),
private = list(
..dep = NA,
..group = NA,
..plotStyle = NA,
..scaling = NA,
..bandwidth = NA,
..binwidth = NA,
..fill = NA,
..colorscheme = NA,
..customColor = NA,
..themeChoice = NA,
..legendPosition = NA,
..mytitle = NA,
..xtitle = NA,
..ytitle = NA)
)
jjridgestatsResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jjridgestatsResults",
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="Ridgeline Plot",
refs=list(
"ggplot2",
"ggridges",
"viridis",
"ClinicoPathJamoviModule"),
clearWith=list(
"dep",
"group",
"scaling",
"bandwidth",
"fill",
"colorscheme",
"mytitle",
"xtitle",
"ytitle",
"originaltheme"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Ridgeline Plot",
renderFun=".plot",
requiresData=TRUE))}))
jjridgestatsBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jjridgestatsBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "jjridgestats",
version = c(1,0,0),
options = options,
results = jjridgestatsResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Ridgeline Plot
#'
#'
#' @param data The data as a data frame.
#' @param dep .
#' @param group .
#' @param plotStyle .
#' @param scaling .
#' @param bandwidth .
#' @param binwidth .
#' @param fill .
#' @param colorscheme .
#' @param customColor .
#' @param themeChoice .
#' @param legendPosition .
#' @param mytitle .
#' @param xtitle .
#' @param ytitle .
#' @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
jjridgestats <- function(
data,
dep,
group,
plotStyle = "density",
scaling = 1,
bandwidth = 1,
binwidth = 1,
fill = TRUE,
colorscheme = "viridis",
customColor = "#4682B4",
themeChoice = "minimal",
legendPosition = "none",
mytitle = "",
xtitle = "",
ytitle = "") {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("jjridgestats 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(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(dep), dep, NULL),
`if`( ! missing(group), group, NULL))
for (v in group) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- jjridgestatsOptions$new(
dep = dep,
group = group,
plotStyle = plotStyle,
scaling = scaling,
bandwidth = bandwidth,
binwidth = binwidth,
fill = fill,
colorscheme = colorscheme,
customColor = customColor,
themeChoice = themeChoice,
legendPosition = legendPosition,
mytitle = mytitle,
xtitle = xtitle,
ytitle = ytitle)
analysis <- jjridgestatsClass$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.