sbalci/ClinicoPathJamoviModule

View on GitHub
R/survivalcont.h.R

Summary

Maintainability
Test Coverage

# This file is automatically generated, you probably don't want to edit this

survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "survivalcontOptions",
    inherit = jmvcore::Options,
    public = list(
        initialize = function(
            elapsedtime = NULL,
            tint = FALSE,
            dxdate = NULL,
            fudate = NULL,
            contexpl = NULL,
            outcome = NULL,
            outcomeLevel = NULL,
            dod = NULL,
            dooc = NULL,
            awd = NULL,
            awod = NULL,
            analysistype = "overall",
            cutp = "12, 36, 60",
            timetypedata = "ymd",
            timetypeoutput = "months",
            uselandmark = FALSE,
            landmark = 3,
            sc = FALSE,
            kmunicate = FALSE,
            ce = FALSE,
            ch = FALSE,
            endplot = 60,
            ybegin_plot = 0,
            yend_plot = 1,
            byplot = 12,
            findcut = FALSE,
            multievent = FALSE,
            ci95 = FALSE,
            risktable = FALSE,
            censored = FALSE, ...) {

            super$initialize(
                package="ClinicoPath",
                name="survivalcont",
                requiresData=TRUE,
                ...)

            private$..elapsedtime <- jmvcore::OptionVariable$new(
                "elapsedtime",
                elapsedtime,
                suggested=list(
                    "continuous"),
                permitted=list(
                    "numeric"))
            private$..tint <- jmvcore::OptionBool$new(
                "tint",
                tint,
                default=FALSE)
            private$..dxdate <- jmvcore::OptionVariable$new(
                "dxdate",
                dxdate)
            private$..fudate <- jmvcore::OptionVariable$new(
                "fudate",
                fudate)
            private$..calculatedtime <- jmvcore::OptionOutput$new(
                "calculatedtime")
            private$..contexpl <- jmvcore::OptionVariable$new(
                "contexpl",
                contexpl,
                suggested=list(
                    "continuous"),
                permitted=list(
                    "numeric"))
            private$..outcome <- jmvcore::OptionVariable$new(
                "outcome",
                outcome,
                suggested=list(
                    "ordinal",
                    "nominal",
                    "continuous"),
                permitted=list(
                    "factor",
                    "numeric"))
            private$..outcomeLevel <- jmvcore::OptionLevel$new(
                "outcomeLevel",
                outcomeLevel,
                variable="(outcome)")
            private$..dod <- jmvcore::OptionLevel$new(
                "dod",
                dod,
                variable="(outcome)",
                allowNone=TRUE)
            private$..dooc <- jmvcore::OptionLevel$new(
                "dooc",
                dooc,
                variable="(outcome)",
                allowNone=TRUE)
            private$..awd <- jmvcore::OptionLevel$new(
                "awd",
                awd,
                variable="(outcome)",
                allowNone=TRUE)
            private$..awod <- jmvcore::OptionLevel$new(
                "awod",
                awod,
                variable="(outcome)",
                allowNone=TRUE)
            private$..analysistype <- jmvcore::OptionList$new(
                "analysistype",
                analysistype,
                options=list(
                    "overall",
                    "cause",
                    "compete"),
                default="overall")
            private$..outcomeredifened <- jmvcore::OptionOutput$new(
                "outcomeredifened")
            private$..cutp <- jmvcore::OptionString$new(
                "cutp",
                cutp,
                default="12, 36, 60")
            private$..timetypedata <- jmvcore::OptionList$new(
                "timetypedata",
                timetypedata,
                options=list(
                    "ymdhms",
                    "ymd",
                    "ydm",
                    "mdy",
                    "myd",
                    "dmy",
                    "dym"),
                default="ymd")
            private$..timetypeoutput <- jmvcore::OptionList$new(
                "timetypeoutput",
                timetypeoutput,
                options=list(
                    "days",
                    "weeks",
                    "months",
                    "years"),
                default="months")
            private$..uselandmark <- jmvcore::OptionBool$new(
                "uselandmark",
                uselandmark,
                default=FALSE)
            private$..landmark <- jmvcore::OptionInteger$new(
                "landmark",
                landmark,
                default=3)
            private$..sc <- jmvcore::OptionBool$new(
                "sc",
                sc,
                default=FALSE)
            private$..kmunicate <- jmvcore::OptionBool$new(
                "kmunicate",
                kmunicate,
                default=FALSE)
            private$..ce <- jmvcore::OptionBool$new(
                "ce",
                ce,
                default=FALSE)
            private$..ch <- jmvcore::OptionBool$new(
                "ch",
                ch,
                default=FALSE)
            private$..endplot <- jmvcore::OptionInteger$new(
                "endplot",
                endplot,
                default=60)
            private$..ybegin_plot <- jmvcore::OptionNumber$new(
                "ybegin_plot",
                ybegin_plot,
                default=0)
            private$..yend_plot <- jmvcore::OptionNumber$new(
                "yend_plot",
                yend_plot,
                default=1)
            private$..byplot <- jmvcore::OptionInteger$new(
                "byplot",
                byplot,
                default=12)
            private$..findcut <- jmvcore::OptionBool$new(
                "findcut",
                findcut,
                default=FALSE)
            private$..calculatedcutoff <- jmvcore::OptionOutput$new(
                "calculatedcutoff")
            private$..multievent <- jmvcore::OptionBool$new(
                "multievent",
                multievent,
                default=FALSE)
            private$..ci95 <- jmvcore::OptionBool$new(
                "ci95",
                ci95,
                default=FALSE)
            private$..risktable <- jmvcore::OptionBool$new(
                "risktable",
                risktable,
                default=FALSE)
            private$..censored <- jmvcore::OptionBool$new(
                "censored",
                censored,
                default=FALSE)

            self$.addOption(private$..elapsedtime)
            self$.addOption(private$..tint)
            self$.addOption(private$..dxdate)
            self$.addOption(private$..fudate)
            self$.addOption(private$..calculatedtime)
            self$.addOption(private$..contexpl)
            self$.addOption(private$..outcome)
            self$.addOption(private$..outcomeLevel)
            self$.addOption(private$..dod)
            self$.addOption(private$..dooc)
            self$.addOption(private$..awd)
            self$.addOption(private$..awod)
            self$.addOption(private$..analysistype)
            self$.addOption(private$..outcomeredifened)
            self$.addOption(private$..cutp)
            self$.addOption(private$..timetypedata)
            self$.addOption(private$..timetypeoutput)
            self$.addOption(private$..uselandmark)
            self$.addOption(private$..landmark)
            self$.addOption(private$..sc)
            self$.addOption(private$..kmunicate)
            self$.addOption(private$..ce)
            self$.addOption(private$..ch)
            self$.addOption(private$..endplot)
            self$.addOption(private$..ybegin_plot)
            self$.addOption(private$..yend_plot)
            self$.addOption(private$..byplot)
            self$.addOption(private$..findcut)
            self$.addOption(private$..calculatedcutoff)
            self$.addOption(private$..multievent)
            self$.addOption(private$..ci95)
            self$.addOption(private$..risktable)
            self$.addOption(private$..censored)
        }),
    active = list(
        elapsedtime = function() private$..elapsedtime$value,
        tint = function() private$..tint$value,
        dxdate = function() private$..dxdate$value,
        fudate = function() private$..fudate$value,
        calculatedtime = function() private$..calculatedtime$value,
        contexpl = function() private$..contexpl$value,
        outcome = function() private$..outcome$value,
        outcomeLevel = function() private$..outcomeLevel$value,
        dod = function() private$..dod$value,
        dooc = function() private$..dooc$value,
        awd = function() private$..awd$value,
        awod = function() private$..awod$value,
        analysistype = function() private$..analysistype$value,
        outcomeredifened = function() private$..outcomeredifened$value,
        cutp = function() private$..cutp$value,
        timetypedata = function() private$..timetypedata$value,
        timetypeoutput = function() private$..timetypeoutput$value,
        uselandmark = function() private$..uselandmark$value,
        landmark = function() private$..landmark$value,
        sc = function() private$..sc$value,
        kmunicate = function() private$..kmunicate$value,
        ce = function() private$..ce$value,
        ch = function() private$..ch$value,
        endplot = function() private$..endplot$value,
        ybegin_plot = function() private$..ybegin_plot$value,
        yend_plot = function() private$..yend_plot$value,
        byplot = function() private$..byplot$value,
        findcut = function() private$..findcut$value,
        calculatedcutoff = function() private$..calculatedcutoff$value,
        multievent = function() private$..multievent$value,
        ci95 = function() private$..ci95$value,
        risktable = function() private$..risktable$value,
        censored = function() private$..censored$value),
    private = list(
        ..elapsedtime = NA,
        ..tint = NA,
        ..dxdate = NA,
        ..fudate = NA,
        ..calculatedtime = NA,
        ..contexpl = NA,
        ..outcome = NA,
        ..outcomeLevel = NA,
        ..dod = NA,
        ..dooc = NA,
        ..awd = NA,
        ..awod = NA,
        ..analysistype = NA,
        ..outcomeredifened = NA,
        ..cutp = NA,
        ..timetypedata = NA,
        ..timetypeoutput = NA,
        ..uselandmark = NA,
        ..landmark = NA,
        ..sc = NA,
        ..kmunicate = NA,
        ..ce = NA,
        ..ch = NA,
        ..endplot = NA,
        ..ybegin_plot = NA,
        ..yend_plot = NA,
        ..byplot = NA,
        ..findcut = NA,
        ..calculatedcutoff = NA,
        ..multievent = NA,
        ..ci95 = NA,
        ..risktable = NA,
        ..censored = NA)
)

survivalcontResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "survivalcontResults",
    inherit = jmvcore::Group,
    active = list(
        todo = function() private$.items[["todo"]],
        coxSummary = function() private$.items[["coxSummary"]],
        coxTable = function() private$.items[["coxTable"]],
        tCoxtext2 = function() private$.items[["tCoxtext2"]],
        rescutTable = function() private$.items[["rescutTable"]],
        plot4 = function() private$.items[["plot4"]],
        plot5 = function() private$.items[["plot5"]],
        medianSummary = function() private$.items[["medianSummary"]],
        medianTable = function() private$.items[["medianTable"]],
        survTableSummary = function() private$.items[["survTableSummary"]],
        survTable = function() private$.items[["survTable"]],
        plot2 = function() private$.items[["plot2"]],
        plot3 = function() private$.items[["plot3"]],
        plot6 = function() private$.items[["plot6"]],
        calculatedtime = function() private$.items[["calculatedtime"]],
        outcomeredifened = function() private$.items[["outcomeredifened"]],
        calculatedcutoff = function() private$.items[["calculatedcutoff"]]),
    private = list(),
    public=list(
        initialize=function(options) {
            super$initialize(
                options=options,
                name="",
                title="Survival Analysis for Continuous Explanatory Variable",
                refs=list(
                    "finalfit",
                    "survival",
                    "survminer",
                    "dichotomizing",
                    "survivaltutorial",
                    "survivalrwnahhas",
                    "ClinicoPathJamoviModule"))
            self$add(jmvcore::Html$new(
                options=options,
                name="todo",
                title="To Do"))
            self$add(jmvcore::Preformatted$new(
                options=options,
                name="coxSummary",
                title="`Cox Regression Summary and Table - ${contexpl}`",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Table$new(
                options=options,
                name="coxTable",
                title="`Cox Table- ${contexpl}`",
                rows=0,
                columns=list(
                    list(
                        `name`="Explanatory", 
                        `title`="Explanatory", 
                        `type`="text"),
                    list(
                        `name`="Levels", 
                        `title`="Levels", 
                        `type`="text"),
                    list(
                        `name`="all", 
                        `title`="all", 
                        `type`="text"),
                    list(
                        `name`="HR_univariable", 
                        `title`="HR (Univariable)", 
                        `type`="text"),
                    list(
                        `name`="HR_multivariable", 
                        `title`="HR (Multivariable)", 
                        `type`="text")),
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Html$new(
                options=options,
                name="tCoxtext2",
                title="",
                refs="finalfit",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Table$new(
                options=options,
                name="rescutTable",
                title="Cut Point",
                rows=0,
                columns=list(
                    list(
                        `name`="cutpoint", 
                        `title`="Cut Point", 
                        `type`="number"),
                    list(
                        `name`="statistic", 
                        `title`="Statistic", 
                        `type`="number")),
                visible="(findcut)",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Image$new(
                options=options,
                name="plot4",
                title="Cutpoint Plot",
                width=600,
                height=450,
                renderFun=".plot4",
                visible="(findcut)",
                requiresData=TRUE,
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Image$new(
                options=options,
                name="plot5",
                title="`Survival Plot - ${contexpl} Grouped with New Cut-Off`",
                width=600,
                height=450,
                renderFun=".plot5",
                visible="(findcut && sc)",
                requiresData=TRUE,
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Preformatted$new(
                options=options,
                name="medianSummary",
                title="`Median Survival Summary and Table - ${contexpl}`",
                visible="(findcut)",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Table$new(
                options=options,
                name="medianTable",
                title="`Median Survival Table: Levels for ${contexpl}`",
                rows=0,
                columns=list(
                    list(
                        `name`="factor", 
                        `title`="Levels", 
                        `type`="text"),
                    list(
                        `name`="records", 
                        `title`="Records", 
                        `type`="number"),
                    list(
                        `name`="events", 
                        `title`="Events", 
                        `type`="integer"),
                    list(
                        `name`="rmean", 
                        `title`="rmean", 
                        `type`="number"),
                    list(
                        `name`="se_rmean", 
                        `title`="se_rmean", 
                        `type`="number"),
                    list(
                        `name`="median", 
                        `title`="Median", 
                        `type`="number"),
                    list(
                        `name`="x0_95lcl", 
                        `title`="Lower", 
                        `superTitle`="95% Confidence Interval", 
                        `type`="number"),
                    list(
                        `name`="x0_95ucl", 
                        `title`="Upper", 
                        `superTitle`="95% Confidence Interval", 
                        `type`="number")),
                visible="(findcut)",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Preformatted$new(
                options=options,
                name="survTableSummary",
                title="`1, 3, 5-yr Survival Summary and Table  - ${contexpl}`",
                visible="(findcut)",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Table$new(
                options=options,
                name="survTable",
                title="`1, 3, 5 year Survival - ${contexpl}`",
                rows=0,
                columns=list(
                    list(
                        `name`="strata", 
                        `title`="Levels", 
                        `type`="text"),
                    list(
                        `name`="time", 
                        `title`="time", 
                        `type`="integer"),
                    list(
                        `name`="n.risk", 
                        `title`="Number at Risk", 
                        `type`="integer"),
                    list(
                        `name`="n.event", 
                        `title`="Number of Events", 
                        `type`="integer"),
                    list(
                        `name`="surv", 
                        `title`="Survival", 
                        `type`="number", 
                        `format`="pc"),
                    list(
                        `name`="lower", 
                        `title`="Lower", 
                        `superTitle`="95% Confidence Interval", 
                        `type`="number", 
                        `format`="pc"),
                    list(
                        `name`="upper", 
                        `title`="Upper", 
                        `superTitle`="95% Confidence Interval", 
                        `type`="number", 
                        `format`="pc")),
                visible="(findcut)",
                clearWith=list(
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Image$new(
                options=options,
                name="plot2",
                title="`Cumulative Events  - ${contexpl} Grouped with New Cut-Off`",
                width=600,
                height=450,
                renderFun=".plot2",
                visible="(findcut && ce)",
                requiresData=TRUE,
                clearWith=list(
                    "ce",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Image$new(
                options=options,
                name="plot3",
                title="`Cumulative Hazard  - ${contexpl} Grouped with New Cut-Off`",
                width=600,
                height=450,
                renderFun=".plot3",
                visible="(findcut && ch)",
                requiresData=TRUE,
                clearWith=list(
                    "ch",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Image$new(
                options=options,
                name="plot6",
                title="`KMunicate-Style Plot  - ${contexpl} Grouped with New Cut-Off`",
                width=600,
                height=450,
                renderFun=".plot6",
                visible="(findcut && kmunicate)",
                requiresData=TRUE,
                clearWith=list(
                    "kmunicate",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent"),
                refs=list(
                    "KMunicate",
                    "KMunicate2")))
            self$add(jmvcore::Output$new(
                options=options,
                name="calculatedtime",
                title="Add Calculated Time to Data",
                varTitle="`Calculated Time in Continious Survival Function - from ${ dxdate } to { fudate }`",
                varDescription="Calculated Time from given Dates in Continious Survival Function",
                clearWith=list(
                    "tint",
                    "dxdate",
                    "fudate",
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Output$new(
                options=options,
                name="outcomeredifened",
                title="Add Redefined Outcome to Data",
                varTitle="`Redefined Outcome in Continious Survival Function - from ${ outcome } for analysis { analysistype }`",
                varDescription="Redefined Outcome from Outcome based on Analysis Type in Continious Survival Function",
                clearWith=list(
                    "outcome",
                    "analysistype",
                    "multievent",
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))
            self$add(jmvcore::Output$new(
                options=options,
                name="calculatedcutoff",
                title="Add Calculated Cut-off Group to Data",
                varTitle="`Calculated Cut-off Group - from ${ contexpl }`",
                varDescription="Calculated Cut-off Group from given Cut-off in Continious Survival Function",
                clearWith=list(
                    "outcome",
                    "analysistype",
                    "multievent",
                    "contexpl",
                    "findcut",
                    "sc",
                    "endplot",
                    "byplot",
                    "ci95",
                    "risktable",
                    "outcome",
                    "outcomeLevel",
                    "overalltime",
                    "findcut",
                    "contexpl",
                    "fudate",
                    "dxdate",
                    "tint",
                    "multievent")))}))

survivalcontBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "survivalcontBase",
    inherit = jmvcore::Analysis,
    public = list(
        initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
            super$initialize(
                package = "ClinicoPath",
                name = "survivalcont",
                version = c(1,0,0),
                options = options,
                results = survivalcontResults$new(options=options),
                data = data,
                datasetId = datasetId,
                analysisId = analysisId,
                revision = revision,
                pause = NULL,
                completeWhenFilled = FALSE,
                requiresMissings = FALSE,
                weightsSupport = 'none')
        }))

#' Survival Analysis for Continuous Variable
#'
#' 
#' @param data The data as a data frame.
#' @param elapsedtime .
#' @param tint .
#' @param dxdate .
#' @param fudate .
#' @param contexpl .
#' @param outcome .
#' @param outcomeLevel .
#' @param dod .
#' @param dooc .
#' @param awd .
#' @param awod .
#' @param analysistype .
#' @param cutp .
#' @param timetypedata select the time type in data
#' @param timetypeoutput select the time type in output
#' @param uselandmark .
#' @param landmark .
#' @param sc .
#' @param kmunicate .
#' @param ce .
#' @param ch .
#' @param endplot .
#' @param ybegin_plot .
#' @param yend_plot .
#' @param byplot .
#' @param findcut .
#' @param multievent .
#' @param ci95 .
#' @param risktable .
#' @param censored .
#' @return A results object containing:
#' \tabular{llllll}{
#'   \code{results$todo} \tab \tab \tab \tab \tab a html \cr
#'   \code{results$coxSummary} \tab \tab \tab \tab \tab a preformatted \cr
#'   \code{results$coxTable} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$tCoxtext2} \tab \tab \tab \tab \tab a html \cr
#'   \code{results$rescutTable} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$plot4} \tab \tab \tab \tab \tab an image \cr
#'   \code{results$plot5} \tab \tab \tab \tab \tab an image \cr
#'   \code{results$medianSummary} \tab \tab \tab \tab \tab a preformatted \cr
#'   \code{results$medianTable} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$survTableSummary} \tab \tab \tab \tab \tab a preformatted \cr
#'   \code{results$survTable} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$plot2} \tab \tab \tab \tab \tab an image \cr
#'   \code{results$plot3} \tab \tab \tab \tab \tab an image \cr
#'   \code{results$plot6} \tab \tab \tab \tab \tab an image \cr
#'   \code{results$calculatedtime} \tab \tab \tab \tab \tab an output \cr
#'   \code{results$outcomeredifened} \tab \tab \tab \tab \tab an output \cr
#'   \code{results$calculatedcutoff} \tab \tab \tab \tab \tab an output \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$coxTable$asDF}
#'
#' \code{as.data.frame(results$coxTable)}
#'
#' @export
survivalcont <- function(
    data,
    elapsedtime,
    tint = FALSE,
    dxdate,
    fudate,
    contexpl,
    outcome,
    outcomeLevel,
    dod,
    dooc,
    awd,
    awod,
    analysistype = "overall",
    cutp = "12, 36, 60",
    timetypedata = "ymd",
    timetypeoutput = "months",
    uselandmark = FALSE,
    landmark = 3,
    sc = FALSE,
    kmunicate = FALSE,
    ce = FALSE,
    ch = FALSE,
    endplot = 60,
    ybegin_plot = 0,
    yend_plot = 1,
    byplot = 12,
    findcut = FALSE,
    multievent = FALSE,
    ci95 = FALSE,
    risktable = FALSE,
    censored = FALSE) {

    if ( ! requireNamespace("jmvcore", quietly=TRUE))
        stop("survivalcont requires jmvcore to be installed (restart may be required)")

    if ( ! missing(elapsedtime)) elapsedtime <- jmvcore::resolveQuo(jmvcore::enquo(elapsedtime))
    if ( ! missing(dxdate)) dxdate <- jmvcore::resolveQuo(jmvcore::enquo(dxdate))
    if ( ! missing(fudate)) fudate <- jmvcore::resolveQuo(jmvcore::enquo(fudate))
    if ( ! missing(contexpl)) contexpl <- jmvcore::resolveQuo(jmvcore::enquo(contexpl))
    if ( ! missing(outcome)) outcome <- jmvcore::resolveQuo(jmvcore::enquo(outcome))
    if (missing(data))
        data <- jmvcore::marshalData(
            parent.frame(),
            `if`( ! missing(elapsedtime), elapsedtime, NULL),
            `if`( ! missing(dxdate), dxdate, NULL),
            `if`( ! missing(fudate), fudate, NULL),
            `if`( ! missing(contexpl), contexpl, NULL),
            `if`( ! missing(outcome), outcome, NULL))


    options <- survivalcontOptions$new(
        elapsedtime = elapsedtime,
        tint = tint,
        dxdate = dxdate,
        fudate = fudate,
        contexpl = contexpl,
        outcome = outcome,
        outcomeLevel = outcomeLevel,
        dod = dod,
        dooc = dooc,
        awd = awd,
        awod = awod,
        analysistype = analysistype,
        cutp = cutp,
        timetypedata = timetypedata,
        timetypeoutput = timetypeoutput,
        uselandmark = uselandmark,
        landmark = landmark,
        sc = sc,
        kmunicate = kmunicate,
        ce = ce,
        ch = ch,
        endplot = endplot,
        ybegin_plot = ybegin_plot,
        yend_plot = yend_plot,
        byplot = byplot,
        findcut = findcut,
        multievent = multievent,
        ci95 = ci95,
        risktable = risktable,
        censored = censored)

    analysis <- survivalcontClass$new(
        options = options,
        data = data)

    analysis$run()

    analysis$results
}