# This file is automatically generated, you probably don't want to edit this
vartree3Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"vartree3Options",
inherit = jmvcore::Options,
public = list(
initialize = function(
vars = NULL,
percvar = NULL,
percvarLevel = NULL,
summaryvar = NULL,
prunebelow = NULL,
pruneLevel1 = NULL,
pruneLevel2 = NULL,
follow = NULL,
followLevel1 = NULL,
followLevel2 = NULL,
excl = FALSE,
vp = TRUE,
horizontal = FALSE,
sline = TRUE,
varnames = FALSE,
nodelabel = TRUE,
pct = FALSE,
showcount = TRUE,
legend = FALSE,
pattern = FALSE,
sequence = FALSE,
ptable = FALSE,
mytitle = "",
useprunesmaller = FALSE,
prunesmaller = 5,
summarylocation = "leafonly",
style = "default",
showInterpretation = TRUE,
survival = FALSE,
labs = FALSE,
response = FALSE, ...) {
super$initialize(
package="ClinicoPath",
name="vartree3",
requiresData=TRUE,
...)
private$..vars <- jmvcore::OptionVariables$new(
"vars",
vars,
suggested=list(
"ordinal",
"nominal"),
permitted=list(
"factor"))
private$..percvar <- jmvcore::OptionVariable$new(
"percvar",
percvar,
suggested=list(
"ordinal",
"nominal"),
permitted=list(
"factor"))
private$..percvarLevel <- jmvcore::OptionLevel$new(
"percvarLevel",
percvarLevel,
variable="(percvar)")
private$..summaryvar <- jmvcore::OptionVariable$new(
"summaryvar",
summaryvar,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..prunebelow <- jmvcore::OptionVariable$new(
"prunebelow",
prunebelow,
suggested=list(
"ordinal",
"nominal"),
permitted=list(
"factor"))
private$..pruneLevel1 <- jmvcore::OptionLevel$new(
"pruneLevel1",
pruneLevel1,
variable="(prunebelow)",
allowNone=TRUE)
private$..pruneLevel2 <- jmvcore::OptionLevel$new(
"pruneLevel2",
pruneLevel2,
variable="(prunebelow)",
allowNone=TRUE)
private$..follow <- jmvcore::OptionVariable$new(
"follow",
follow,
suggested=list(
"ordinal",
"nominal"),
permitted=list(
"factor"))
private$..followLevel1 <- jmvcore::OptionLevel$new(
"followLevel1",
followLevel1,
variable="(follow)",
allowNone=TRUE)
private$..followLevel2 <- jmvcore::OptionLevel$new(
"followLevel2",
followLevel2,
variable="(follow)",
allowNone=TRUE)
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=FALSE)
private$..vp <- jmvcore::OptionBool$new(
"vp",
vp,
default=TRUE)
private$..horizontal <- jmvcore::OptionBool$new(
"horizontal",
horizontal,
default=FALSE)
private$..sline <- jmvcore::OptionBool$new(
"sline",
sline,
default=TRUE)
private$..varnames <- jmvcore::OptionBool$new(
"varnames",
varnames,
default=FALSE)
private$..nodelabel <- jmvcore::OptionBool$new(
"nodelabel",
nodelabel,
default=TRUE)
private$..pct <- jmvcore::OptionBool$new(
"pct",
pct,
default=FALSE)
private$..showcount <- jmvcore::OptionBool$new(
"showcount",
showcount,
default=TRUE)
private$..legend <- jmvcore::OptionBool$new(
"legend",
legend,
default=FALSE)
private$..pattern <- jmvcore::OptionBool$new(
"pattern",
pattern,
default=FALSE)
private$..sequence <- jmvcore::OptionBool$new(
"sequence",
sequence,
default=FALSE)
private$..ptable <- jmvcore::OptionBool$new(
"ptable",
ptable,
default=FALSE)
private$..mytitle <- jmvcore::OptionString$new(
"mytitle",
mytitle,
default="")
private$..useprunesmaller <- jmvcore::OptionBool$new(
"useprunesmaller",
useprunesmaller,
default=FALSE)
private$..prunesmaller <- jmvcore::OptionInteger$new(
"prunesmaller",
prunesmaller,
default=5)
private$..summarylocation <- jmvcore::OptionList$new(
"summarylocation",
summarylocation,
options=list(
"allnodes",
"leafonly"),
default="leafonly")
private$..style <- jmvcore::OptionList$new(
"style",
style,
options=list(
"default",
"clean",
"minimal"),
default="default")
private$..showInterpretation <- jmvcore::OptionBool$new(
"showInterpretation",
showInterpretation,
default=TRUE)
private$..survival <- jmvcore::OptionBool$new(
"survival",
survival,
default=FALSE)
private$..labs <- jmvcore::OptionBool$new(
"labs",
labs,
default=FALSE)
private$..response <- jmvcore::OptionBool$new(
"response",
response,
default=FALSE)
self$.addOption(private$..vars)
self$.addOption(private$..percvar)
self$.addOption(private$..percvarLevel)
self$.addOption(private$..summaryvar)
self$.addOption(private$..prunebelow)
self$.addOption(private$..pruneLevel1)
self$.addOption(private$..pruneLevel2)
self$.addOption(private$..follow)
self$.addOption(private$..followLevel1)
self$.addOption(private$..followLevel2)
self$.addOption(private$..excl)
self$.addOption(private$..vp)
self$.addOption(private$..horizontal)
self$.addOption(private$..sline)
self$.addOption(private$..varnames)
self$.addOption(private$..nodelabel)
self$.addOption(private$..pct)
self$.addOption(private$..showcount)
self$.addOption(private$..legend)
self$.addOption(private$..pattern)
self$.addOption(private$..sequence)
self$.addOption(private$..ptable)
self$.addOption(private$..mytitle)
self$.addOption(private$..useprunesmaller)
self$.addOption(private$..prunesmaller)
self$.addOption(private$..summarylocation)
self$.addOption(private$..style)
self$.addOption(private$..showInterpretation)
self$.addOption(private$..survival)
self$.addOption(private$..labs)
self$.addOption(private$..response)
}),
active = list(
vars = function() private$..vars$value,
percvar = function() private$..percvar$value,
percvarLevel = function() private$..percvarLevel$value,
summaryvar = function() private$..summaryvar$value,
prunebelow = function() private$..prunebelow$value,
pruneLevel1 = function() private$..pruneLevel1$value,
pruneLevel2 = function() private$..pruneLevel2$value,
follow = function() private$..follow$value,
followLevel1 = function() private$..followLevel1$value,
followLevel2 = function() private$..followLevel2$value,
excl = function() private$..excl$value,
vp = function() private$..vp$value,
horizontal = function() private$..horizontal$value,
sline = function() private$..sline$value,
varnames = function() private$..varnames$value,
nodelabel = function() private$..nodelabel$value,
pct = function() private$..pct$value,
showcount = function() private$..showcount$value,
legend = function() private$..legend$value,
pattern = function() private$..pattern$value,
sequence = function() private$..sequence$value,
ptable = function() private$..ptable$value,
mytitle = function() private$..mytitle$value,
useprunesmaller = function() private$..useprunesmaller$value,
prunesmaller = function() private$..prunesmaller$value,
summarylocation = function() private$..summarylocation$value,
style = function() private$..style$value,
showInterpretation = function() private$..showInterpretation$value,
survival = function() private$..survival$value,
labs = function() private$..labs$value,
response = function() private$..response$value),
private = list(
..vars = NA,
..percvar = NA,
..percvarLevel = NA,
..summaryvar = NA,
..prunebelow = NA,
..pruneLevel1 = NA,
..pruneLevel2 = NA,
..follow = NA,
..followLevel1 = NA,
..followLevel2 = NA,
..excl = NA,
..vp = NA,
..horizontal = NA,
..sline = NA,
..varnames = NA,
..nodelabel = NA,
..pct = NA,
..showcount = NA,
..legend = NA,
..pattern = NA,
..sequence = NA,
..ptable = NA,
..mytitle = NA,
..useprunesmaller = NA,
..prunesmaller = NA,
..summarylocation = NA,
..style = NA,
..showInterpretation = NA,
..survival = NA,
..labs = NA,
..response = NA)
)
vartree3Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"vartree3Results",
inherit = jmvcore::Group,
active = list(
todo = function() private$.items[["todo"]],
text1 = function() private$.items[["text1"]],
text2 = function() private$.items[["text2"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Variable Tree V3",
refs=list(
"vtree",
"ClinicoPathJamoviModule"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do"))
self$add(jmvcore::Html$new(
options=options,
name="text1",
title="Variable Tree V3"))
self$add(jmvcore::Preformatted$new(
options=options,
name="text2",
title="Pattern Table",
visible="(ptable)"))}))
vartree3Base <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"vartree3Base",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "vartree3",
version = c(1,0,0),
options = options,
results = vartree3Results$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Variable Tree V3
#'
#' Function for Generating Enhanced Tree Summaries of Variables
#'
#' @examples
#' \donttest{
#' # Example will be added
#'}
#' @param data The data as a data frame.
#' @param vars .
#' @param percvar .
#' @param percvarLevel .
#' @param summaryvar .
#' @param prunebelow .
#' @param pruneLevel1 .
#' @param pruneLevel2 .
#' @param follow .
#' @param followLevel1 .
#' @param followLevel2 .
#' @param excl .
#' @param vp .
#' @param horizontal .
#' @param sline .
#' @param varnames .
#' @param nodelabel .
#' @param pct .
#' @param showcount .
#' @param legend .
#' @param pattern .
#' @param sequence .
#' @param ptable .
#' @param mytitle .
#' @param useprunesmaller .
#' @param prunesmaller .
#' @param summarylocation .
#' @param style .
#' @param showInterpretation .
#' @param survival .
#' @param labs .
#' @param response .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text1} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text2} \tab \tab \tab \tab \tab a preformatted \cr
#' }
#'
#' @export
vartree3 <- function(
data,
vars,
percvar,
percvarLevel,
summaryvar,
prunebelow,
pruneLevel1,
pruneLevel2,
follow,
followLevel1,
followLevel2,
excl = FALSE,
vp = TRUE,
horizontal = FALSE,
sline = TRUE,
varnames = FALSE,
nodelabel = TRUE,
pct = FALSE,
showcount = TRUE,
legend = FALSE,
pattern = FALSE,
sequence = FALSE,
ptable = FALSE,
mytitle = "",
useprunesmaller = FALSE,
prunesmaller = 5,
summarylocation = "leafonly",
style = "default",
showInterpretation = TRUE,
survival = FALSE,
labs = FALSE,
response = FALSE) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("vartree3 requires jmvcore to be installed (restart may be required)")
if ( ! missing(vars)) vars <- jmvcore::resolveQuo(jmvcore::enquo(vars))
if ( ! missing(percvar)) percvar <- jmvcore::resolveQuo(jmvcore::enquo(percvar))
if ( ! missing(summaryvar)) summaryvar <- jmvcore::resolveQuo(jmvcore::enquo(summaryvar))
if ( ! missing(prunebelow)) prunebelow <- jmvcore::resolveQuo(jmvcore::enquo(prunebelow))
if ( ! missing(follow)) follow <- jmvcore::resolveQuo(jmvcore::enquo(follow))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(vars), vars, NULL),
`if`( ! missing(percvar), percvar, NULL),
`if`( ! missing(summaryvar), summaryvar, NULL),
`if`( ! missing(prunebelow), prunebelow, NULL),
`if`( ! missing(follow), follow, NULL))
for (v in vars) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in percvar) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in prunebelow) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in follow) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- vartree3Options$new(
vars = vars,
percvar = percvar,
percvarLevel = percvarLevel,
summaryvar = summaryvar,
prunebelow = prunebelow,
pruneLevel1 = pruneLevel1,
pruneLevel2 = pruneLevel2,
follow = follow,
followLevel1 = followLevel1,
followLevel2 = followLevel2,
excl = excl,
vp = vp,
horizontal = horizontal,
sline = sline,
varnames = varnames,
nodelabel = nodelabel,
pct = pct,
showcount = showcount,
legend = legend,
pattern = pattern,
sequence = sequence,
ptable = ptable,
mytitle = mytitle,
useprunesmaller = useprunesmaller,
prunesmaller = prunesmaller,
summarylocation = summarylocation,
style = style,
showInterpretation = showInterpretation,
survival = survival,
labs = labs,
response = response)
analysis <- vartree3Class$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.