# This file is automatically generated, you probably don't want to edit this
tableoneOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"tableoneOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
vars = NULL,
sty = "t1",
excl = TRUE, ...) {
super$initialize(
package="ClinicoPathLinuxDescriptives",
name="tableone",
requiresData=TRUE,
...)
private$..vars <- jmvcore::OptionVariables$new(
"vars",
vars)
private$..sty <- jmvcore::OptionList$new(
"sty",
sty,
options=list(
"t1",
"t2",
"t3",
"t4"),
default="t1")
private$..excl <- jmvcore::OptionBool$new(
"excl",
excl,
default=TRUE)
self$.addOption(private$..vars)
self$.addOption(private$..sty)
self$.addOption(private$..excl)
}),
active = list(
vars = function() private$..vars$value,
sty = function() private$..sty$value,
excl = function() private$..excl$value),
private = list(
..vars = NA,
..sty = NA,
..excl = NA)
)
tableoneResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"tableoneResults",
inherit = jmvcore::Group,
active = list(
todo = function() private$.items[["todo"]],
tablestyle1 = function() private$.items[["tablestyle1"]],
tablestyle2 = function() private$.items[["tablestyle2"]],
tablestyle3 = function() private$.items[["tablestyle3"]],
tablestyle4 = function() private$.items[["tablestyle4"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Table One",
refs=list(
"ClinicoPathJamoviModule"))
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do"))
self$add(jmvcore::Preformatted$new(
options=options,
name="tablestyle1",
title="",
clearWith=list(
"vars",
"excl"),
visible="(sty:t1)",
refs="tableone"))
self$add(jmvcore::Html$new(
options=options,
name="tablestyle2",
title="",
clearWith=list(
"vars",
"excl"),
visible="(sty:t2)",
refs="gtsummary"))
self$add(jmvcore::Html$new(
options=options,
name="tablestyle3",
title="",
clearWith=list(
"vars",
"excl"),
visible="(sty:t3)",
refs="arsenal"))
self$add(jmvcore::Preformatted$new(
options=options,
name="tablestyle4",
title="",
clearWith=list(
"vars",
"excl"),
visible="(sty:t4)",
refs="janitor"))}))
tableoneBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"tableoneBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPathLinuxDescriptives",
name = "tableone",
version = c(0,0,1),
options = options,
results = tableoneResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Table One
#'
#' Function for making Table One.
#'
#' @examples
#' \dontrun{
#' data('histopathology')
#' dat <- as.data.frame(histopathology)
#' ClinicoPath::tableone(
#' data = dat,
#' vars = vars(Sex, PreinvasiveComponent, LVI, PNI, Grade, Age),
#' sty = "t3",
#' excl = TRUE)
#'}
#' @param data The data as a data frame.
#' @param vars a string naming the variables from \code{data} that contains
#' the values used for the Table One.
#' @param sty .
#' @param excl .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#' \code{results$tablestyle1} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$tablestyle2} \tab \tab \tab \tab \tab a html \cr
#' \code{results$tablestyle3} \tab \tab \tab \tab \tab a html \cr
#' \code{results$tablestyle4} \tab \tab \tab \tab \tab a preformatted \cr
#' }
#'
#' @export
tableone <- function(
data,
vars,
sty = "t1",
excl = TRUE) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("tableone requires jmvcore to be installed (restart may be required)")
if ( ! missing(vars)) vars <- jmvcore::resolveQuo(jmvcore::enquo(vars))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(vars), vars, NULL))
options <- tableoneOptions$new(
vars = vars,
sty = sty,
excl = excl)
analysis <- tableoneClass$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.