# 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,
medianline = "none", ...) {
super$initialize(
package="jsurvival",
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$..outcomeredefined <- jmvcore::OptionOutput$new(
"outcomeredefined")
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)
private$..medianline <- jmvcore::OptionList$new(
"medianline",
medianline,
options=list(
"none",
"h",
"v",
"hv"),
default="none")
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$..outcomeredefined)
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)
self$.addOption(private$..medianline)
}),
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,
outcomeredefined = function() private$..outcomeredefined$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,
medianline = function() private$..medianline$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,
..outcomeredefined = 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,
..medianline = 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"]],
outcomeredefined = function() private$.items[["outcomeredefined"]],
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="outcomeredefined",
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 = "jsurvival",
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 The time-to-event or follow-up duration for each
#' patient. Should be numeric and continuous, measured in consistent units
#' (e.g., months or years). Can be calculated automatically from dates if
#' using the date options below.
#' @param tint Enable this option if you want to calculate survival time from
#' dates in your data. This is useful when you have separate columns for
#' diagnosis date and follow-up date and want to calculate the time elapsed
#' between them.
#' @param dxdate The date of diagnosis or study entry for each patient. Should
#' be in a consistent date format (e.g., YYYY-MM-DD).
#' @param fudate The date of last follow-up or event for each patient. Should
#' be in a consistent date format (e.g., YYYY-MM-DD).
#' @param contexpl The continuous explanatory variable to be used in the
#' analysis.
#' @param outcome The outcome variable to be used in the analysis.
#' @param outcomeLevel The level of the outcome variable that represents the
#' event of interest.
#' @param dod .
#' @param dooc .
#' @param awd .
#' @param awod Select the levels of the outcome variable that correspond to
#' different event types in your data. For example, you might have separate
#' levels for "Dead of Disease" and "Alive w Disease" in a survival analysis
#' of cancer patients.
#' @param analysistype Select the type of survival analysis to perform.
#' "Overall" survival analysis considers all events as equivalent, while
#' "Cause Specific" analysis distinguishes between different event types.
#' "Competing Risk" analysis accounts for competing risks that may prevent the
#' event of interest from occurring.
#' @param cutp Specify the cutpoints at which to divide the continuous
#' explanatory variable into groups for survival analysis. Separate multiple
#' cutpoints with commas (e.g., "12, 36, 60").
#' @param timetypedata select the time type in data
#' @param timetypeoutput select the time type in output
#' @param uselandmark Enable this option to perform landmark survival analysis
#' at a specified time point.
#' @param landmark Specify the landmark time at which to evaluate survival
#' probabilities in landmark analysis. This option is only available if you
#' enable the "Use Landmark Time" option.
#' @param sc Enable this option to create a Kaplan-Meier survival plot for the
#' continuous explanatory variable.
#' @param kmunicate Enable this option to create a KMunicate-style survival
#' plot for the continuous explanatory variable.
#' @param ce Enable this option to create a plot of cumulative events over
#' time for the continuous explanatory variable.
#' @param ch Enable this option to create a plot of cumulative hazard over
#' time for the continuous explanatory variable.
#' @param endplot Specify the end time for the survival plots. This option
#' determines the maximum time point to include in the plots.
#' @param ybegin_plot Specify the starting value for the y-axis in the
#' survival plots. This option allows you to customize the range of the
#' y-axis.
#' @param yend_plot Specify the ending value for the y-axis in the survival
#' plots. This option allows you to customize the range of the y-axis.
#' @param byplot Specify the time interval for the survival plots. This option
#' determines the spacing of tick marks on the x-axis.
#' @param findcut Enable this option to automatically find the optimal cut-off
#' point for the continuous explanatory variable using the maximally selected
#' rank statistic. This option is only available if you enable the "Survival
#' Plot" option. The optimal cut-off point will be displayed on the survival
#' plot as a vertical dashed line.
#' @param multievent Enable this option if your data includes multiple event
#' levels (e.g., different types of events or outcomes). This option is
#' required for cause-specific and competing risk survival analyses.
#' @param ci95 Enable this option to display 95\% confidence intervals around
#' the survival estimates in the plots.
#' @param risktable Enable this option to display a table of risk estimates
#' for each group in the survival analysis.
#' @param censored Enable this option to display censored observations in the
#' survival plots.
#' @param medianline If true, displays a line indicating the median survival
#' time on the survival plot.
#' @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$outcomeredefined} \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,
medianline = "none") {
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,
medianline = medianline)
analysis <- survivalcontClass$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.