# This file is automatically generated, you probably don't want to edit this
multisurvivalOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"multisurvivalOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
explanatory = NULL,
outcome = NULL,
overalltime = NULL,
sty = "t1",
ac = FALSE,
adjexplanatory = NULL, ...) {
super$initialize(
package='ClinicoPath',
name='multisurvival',
requiresData=TRUE,
...)
private$..explanatory <- jmvcore::OptionVariables$new(
"explanatory",
explanatory)
private$..outcome <- jmvcore::OptionVariable$new(
"outcome",
outcome,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..overalltime <- jmvcore::OptionVariable$new(
"overalltime",
overalltime,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..sty <- jmvcore::OptionList$new(
"sty",
sty,
options=list(
"t1",
"t3"),
default="t1")
private$..ac <- jmvcore::OptionBool$new(
"ac",
ac,
default=FALSE)
private$..adjexplanatory <- jmvcore::OptionVariable$new(
"adjexplanatory",
adjexplanatory)
self$.addOption(private$..explanatory)
self$.addOption(private$..outcome)
self$.addOption(private$..overalltime)
self$.addOption(private$..sty)
self$.addOption(private$..ac)
self$.addOption(private$..adjexplanatory)
}),
active = list(
explanatory = function() private$..explanatory$value,
outcome = function() private$..outcome$value,
overalltime = function() private$..overalltime$value,
sty = function() private$..sty$value,
ac = function() private$..ac$value,
adjexplanatory = function() private$..adjexplanatory$value),
private = list(
..explanatory = NA,
..outcome = NA,
..overalltime = NA,
..sty = NA,
..ac = NA,
..adjexplanatory = NA)
)
multisurvivalResults <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jmvcore::Group,
active = list(
todo = function() private$.items[["todo"]],
text = function() private$.items[["text"]],
plot = function() private$.items[["plot"]],
plot3 = function() private$.items[["plot3"]],
plot4 = function() private$.items[["plot4"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Multivariate Survival Analysis")
self$add(jmvcore::Html$new(
options=options,
name="todo",
title="To Do",
clearWith=list(
"explanatory",
"outcome",
"overalltime")))
self$add(jmvcore::Html$new(
options=options,
name="text",
title="Multivariate Survival",
clearWith=list(
"explanatory",
"outcome",
"overalltime"),
refs="finalfit"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Hazards Regression Plot",
width=600,
height=450,
renderFun=".plot",
requiresData=TRUE,
clearWith=list(
"explanatory",
"outcome",
"overalltime"),
visible="(sty:t1)",
refs="finalfit"))
self$add(jmvcore::Image$new(
options=options,
name="plot3",
title="Hazards Regression (Forest) Plot",
width=800,
height=600,
renderFun=".plot3",
requiresData=TRUE,
clearWith=list(
"explanatory",
"outcome",
"overalltime"),
visible="(sty:t3)",
refs="survminer"))
self$add(jmvcore::Image$new(
options=options,
name="plot4",
title="Show Adjusted Survival Curve",
width=800,
height=600,
renderFun=".plot4",
requiresData=TRUE,
clearWith=list(
"explanatory",
"outcome",
"overalltime",
"adjexplanatory"),
visible="(ac)",
refs="survminer"))}))
multisurvivalBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"multisurvivalBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = 'ClinicoPath',
name = 'multisurvival',
version = c(1,0,0),
options = options,
results = multisurvivalResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE)
}))
#' Multivariate Survival Analysis
#'
#' Function for Multivariate Survival Analysis using Cox-regression.
#'
#' @examples
#' \dontrun{
#' # example will be added
#'}
#' @param data The data as a data frame.
#' @param explanatory .
#' @param outcome .
#' @param overalltime .
#' @param sty .
#' @param ac .
#' @param adjexplanatory .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text} \tab \tab \tab \tab \tab a html \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot3} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot4} \tab \tab \tab \tab \tab an image \cr
#' }
#'
#' @export
multisurvival <- function(
data,
explanatory,
outcome,
overalltime,
sty = "t1",
ac = FALSE,
adjexplanatory) {
if ( ! requireNamespace('jmvcore'))
stop('multisurvival requires jmvcore to be installed (restart may be required)')
if ( ! missing(explanatory)) explanatory <- jmvcore::resolveQuo(jmvcore::enquo(explanatory))
if ( ! missing(outcome)) outcome <- jmvcore::resolveQuo(jmvcore::enquo(outcome))
if ( ! missing(overalltime)) overalltime <- jmvcore::resolveQuo(jmvcore::enquo(overalltime))
if ( ! missing(adjexplanatory)) adjexplanatory <- jmvcore::resolveQuo(jmvcore::enquo(adjexplanatory))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(explanatory), explanatory, NULL),
`if`( ! missing(outcome), outcome, NULL),
`if`( ! missing(overalltime), overalltime, NULL),
`if`( ! missing(adjexplanatory), adjexplanatory, NULL))
options <- multisurvivalOptions$new(
explanatory = explanatory,
outcome = outcome,
overalltime = overalltime,
sty = sty,
ac = ac,
adjexplanatory = adjexplanatory)
analysis <- multisurvivalClass$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.