From 269bf574c10ae1dc49169c63ee14af4cc002afe9 Mon Sep 17 00:00:00 2001 From: sbalci Date: Mon, 11 Dec 2023 19:43:40 +0300 Subject: [PATCH] WIP --- DESCRIPTION | 4 +-- R/multisurvival.h.R | 41 ++++++++++++++++++++++-- R/oddsratio.b.R | 36 ++++++++++----------- R/oddsratio.h.R | 6 ---- R/singlearm.h.R | 37 ++++++++++++++++++++-- R/survivalcont.b.R | 58 +++++++++++++++++++++++++++++----- R/survivalcont.h.R | 63 ++++++++++++++++++++++++++++++++----- jamovi/0000.yaml | 4 +-- jamovi/multisurvival.a.yaml | 23 +++++++------- jamovi/multisurvival.r.yaml | 36 ++++++++++----------- jamovi/multisurvival.u.yaml | 7 +++++ jamovi/oddsratio.r.yaml | 6 ++-- jamovi/singlearm.a.yaml | 25 ++++++++++----- jamovi/singlearm.u.yaml | 42 +++++++++++++------------ jamovi/survivalcont.a.yaml | 54 +++++++++++++++---------------- jamovi/survivalcont.u.yaml | 57 ++++++++++++++++----------------- man/multisurvival.Rd | 2 ++ man/oddsratio.Rd | 1 - man/singlearm.Rd | 6 ++++ man/survivalcont.Rd | 11 ++++++- 20 files changed, 354 insertions(+), 165 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 96c01c0b..4a77b247 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: ClinicoPath Title: Analysis for Clinicopathological Research -Version: 0.0.2.13 -Date: 2023-12-10 +Version: 0.0.2.14 +Date: 2023-12-11 Authors@R: person(given = "Serdar", family = "Balci", diff --git a/R/multisurvival.h.R b/R/multisurvival.h.R index ed621c54..b4c82569 100644 --- a/R/multisurvival.h.R +++ b/R/multisurvival.h.R @@ -108,8 +108,11 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla analysistype, options=list( "overall", - "cause"), + "cause", + "compete"), default="overall") + private$..outcomeredifened <- jmvcore::OptionOutput$new( + "outcomeredifened") private$..timetypedata <- jmvcore::OptionList$new( "timetypedata", timetypedata, @@ -139,6 +142,8 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla "landmark", landmark, default=3) + private$..calculatedtime <- jmvcore::OptionOutput$new( + "calculatedtime") private$..hr <- jmvcore::OptionBool$new( "hr", hr, @@ -165,10 +170,12 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla self$.addOption(private$..contexpl) self$.addOption(private$..multievent) self$.addOption(private$..analysistype) + self$.addOption(private$..outcomeredifened) self$.addOption(private$..timetypedata) self$.addOption(private$..timetypeoutput) self$.addOption(private$..uselandmark) self$.addOption(private$..landmark) + self$.addOption(private$..calculatedtime) self$.addOption(private$..hr) self$.addOption(private$..sty) }), @@ -187,10 +194,12 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla contexpl = function() private$..contexpl$value, multievent = function() private$..multievent$value, analysistype = function() private$..analysistype$value, + outcomeredifened = function() private$..outcomeredifened$value, timetypedata = function() private$..timetypedata$value, timetypeoutput = function() private$..timetypeoutput$value, uselandmark = function() private$..uselandmark$value, landmark = function() private$..landmark$value, + calculatedtime = function() private$..calculatedtime$value, hr = function() private$..hr$value, sty = function() private$..sty$value), private = list( @@ -208,10 +217,12 @@ multisurvivalOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla ..contexpl = NA, ..multievent = NA, ..analysistype = NA, + ..outcomeredifened = NA, ..timetypedata = NA, ..timetypeoutput = NA, ..uselandmark = NA, ..landmark = NA, + ..calculatedtime = NA, ..hr = NA, ..sty = NA) ) @@ -225,7 +236,9 @@ multisurvivalResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla text = function() private$.items[["text"]], text2 = function() private$.items[["text2"]], plot = function() private$.items[["plot"]], - plot3 = function() private$.items[["plot3"]]), + plot3 = function() private$.items[["plot3"]], + calculatedtime = function() private$.items[["calculatedtime"]], + outcomeredifened = function() private$.items[["outcomeredifened"]]), private = list(), public=list( initialize=function(options) { @@ -339,6 +352,26 @@ multisurvivalResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cla "fudate", "dxdate", "tint", + "multievent"))) + self$add(jmvcore::Output$new( + options=options, + name="calculatedtime", + title="Add Calculated Time to Data", + varTitle="`Calculated Time in Multivariable Survival Function - from ${ dxdate } to { fudate }`", + varDescription="Calculated Time from given Dates", + clearWith=list( + "tint", + "dxdate", + "fudate"))) + self$add(jmvcore::Output$new( + options=options, + name="outcomeredifened", + title="Add Redefined Outcome to Data", + varTitle="`Redefined Outcome in Multivariable Survival Function - from ${ outcome } for analysis { analysistype }`", + varDescription="Redefined Outcome from Outcome based on Analysis Type", + clearWith=list( + "outcome", + "analysistype", "multievent")))})) multisurvivalBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( @@ -359,7 +392,7 @@ multisurvivalBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( pause = NULL, completeWhenFilled = FALSE, requiresMissings = FALSE, - weightsSupport = 'auto') + weightsSupport = 'none') })) #' Multivariable Survival Analysis @@ -399,6 +432,8 @@ multisurvivalBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( #' \code{results$text2} \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$calculatedtime} \tab \tab \tab \tab \tab an output \cr +#' \code{results$outcomeredifened} \tab \tab \tab \tab \tab an output \cr #' } #' #' @export diff --git a/R/oddsratio.b.R b/R/oddsratio.b.R index 63f21ee5..72052ed6 100644 --- a/R/oddsratio.b.R +++ b/R/oddsratio.b.R @@ -236,24 +236,24 @@ oddsratioClass <- if (requireNamespace('jmvcore')) R6::R6Class( # ) -> tOdds - self$results$textmydata$setContent( - list( - head = head(mydata), - names_data = names(mydata), - all_labels = all_labels, - explanatory_variable_names = explanatory_variable_names, - dependent_variable_name_from_label = dependent_variable_name_from_label, - formulaDependent = formulaDependent, - formulaExplanatory = formulaExplanatory - # formula2 = formula2, - # formulaR = formulaR, - # formulaL = formulaL, - # formulaL2 = formulaL2, - # formulaR3, - , - tOdds - ) - ) + # self$results$textmydata$setContent( + # list( + # head = head(mydata), + # names_data = names(mydata), + # all_labels = all_labels, + # explanatory_variable_names = explanatory_variable_names, + # dependent_variable_name_from_label = dependent_variable_name_from_label, + # formulaDependent = formulaDependent, + # formulaExplanatory = formulaExplanatory + # # formula2 = formula2, + # # formulaR = formulaR, + # # formulaL = formulaL, + # # formulaL2 = formulaL2, + # # formulaR3, + # , + # tOdds + # ) + # ) text2 <- glue::glue(" diff --git a/R/oddsratio.h.R b/R/oddsratio.h.R index 3ebb1017..9fe05a6a 100644 --- a/R/oddsratio.h.R +++ b/R/oddsratio.h.R @@ -43,7 +43,6 @@ oddsratioResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( inherit = jmvcore::Group, active = list( todo = function() private$.items[["todo"]], - textmydata = function() private$.items[["textmydata"]], text = function() private$.items[["text"]], text2 = function() private$.items[["text2"]], plot = function() private$.items[["plot"]]), @@ -65,10 +64,6 @@ oddsratioResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( clearWith=list( "explanatory", "outcome"))) - self$add(jmvcore::Preformatted$new( - options=options, - name="textmydata", - title="textmydata")) self$add(jmvcore::Html$new( options=options, name="text", @@ -127,7 +122,6 @@ oddsratioBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( #' @return A results object containing: #' \tabular{llllll}{ #' \code{results$todo} \tab \tab \tab \tab \tab a html \cr -#' \code{results$textmydata} \tab \tab \tab \tab \tab a preformatted \cr #' \code{results$text} \tab \tab \tab \tab \tab a html \cr #' \code{results$text2} \tab \tab \tab \tab \tab a html \cr #' \code{results$plot} \tab \tab \tab \tab \tab an image \cr diff --git a/R/singlearm.h.R b/R/singlearm.h.R index d272a415..ef39a3b7 100644 --- a/R/singlearm.h.R +++ b/R/singlearm.h.R @@ -27,6 +27,8 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, multievent = FALSE, ci95 = FALSE, @@ -56,6 +58,8 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( private$..fudate <- jmvcore::OptionVariable$new( "fudate", fudate) + private$..calculatedtime <- jmvcore::OptionOutput$new( + "calculatedtime") private$..outcome <- jmvcore::OptionVariable$new( "outcome", outcome, @@ -95,8 +99,11 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( analysistype, options=list( "overall", - "cause"), + "cause", + "compete"), default="overall") + private$..outcomeredifened <- jmvcore::OptionOutput$new( + "outcomeredifened") private$..cutp <- jmvcore::OptionString$new( "cutp", cutp, @@ -150,6 +157,14 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( "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, @@ -175,6 +190,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( self$.addOption(private$..tint) self$.addOption(private$..dxdate) self$.addOption(private$..fudate) + self$.addOption(private$..calculatedtime) self$.addOption(private$..outcome) self$.addOption(private$..outcomeLevel) self$.addOption(private$..dod) @@ -182,6 +198,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( 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) @@ -192,6 +209,8 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( 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$..multievent) self$.addOption(private$..ci95) @@ -203,6 +222,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( tint = function() private$..tint$value, dxdate = function() private$..dxdate$value, fudate = function() private$..fudate$value, + calculatedtime = function() private$..calculatedtime$value, outcome = function() private$..outcome$value, outcomeLevel = function() private$..outcomeLevel$value, dod = function() private$..dod$value, @@ -210,6 +230,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( 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, @@ -220,6 +241,8 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( 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, multievent = function() private$..multievent$value, ci95 = function() private$..ci95$value, @@ -230,6 +253,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( ..tint = NA, ..dxdate = NA, ..fudate = NA, + ..calculatedtime = NA, ..outcome = NA, ..outcomeLevel = NA, ..dod = NA, @@ -237,6 +261,7 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( ..awd = NA, ..awod = NA, ..analysistype = NA, + ..outcomeredifened = NA, ..cutp = NA, ..timetypedata = NA, ..timetypeoutput = NA, @@ -247,6 +272,8 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( ..ce = NA, ..ch = NA, ..endplot = NA, + ..ybegin_plot = NA, + ..yend_plot = NA, ..byplot = NA, ..multievent = NA, ..ci95 = NA, @@ -554,7 +581,7 @@ singlearmBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( pause = NULL, completeWhenFilled = FALSE, requiresMissings = FALSE, - weightsSupport = 'auto') + weightsSupport = 'none') })) #' Single Arm Survival @@ -586,6 +613,8 @@ singlearmBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( #' @param ce . #' @param ch . #' @param endplot . +#' @param ybegin_plot . +#' @param yend_plot . #' @param byplot . #' @param multievent . #' @param ci95 . @@ -636,6 +665,8 @@ singlearm <- function( ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, multievent = FALSE, ci95 = FALSE, @@ -680,6 +711,8 @@ singlearm <- function( ce = ce, ch = ch, endplot = endplot, + ybegin_plot = ybegin_plot, + yend_plot = yend_plot, byplot = byplot, multievent = multievent, ci95 = ci95, diff --git a/R/survivalcont.b.R b/R/survivalcont.b.R index 82b55828..e04665aa 100644 --- a/R/survivalcont.b.R +++ b/R/survivalcont.b.R @@ -21,18 +21,63 @@ survivalcontClass <- if (requireNamespace('jmvcore')) } + , - .todo = function() { + .getData = function() { - if ( + mydata <- self$data - (is.null(self$options$outcome) && !(self$options$multievent)) || + mydata$row_names <- rownames(mydata) - (self$options$multievent && (is.null(self$options$dod) && is.null(self$options$dooc) && is.null(self$options$awd) && is.null(self$options$awod))) || + original_names <- names(mydata) - (self$options$tint && (is.null(self$options$dxdate) || is.null(self$options$fudate))) || + labels <- setNames(original_names, original_names) + + mydata <- mydata %>% janitor::clean_names() + + corrected_labels <- + setNames(original_names, names(mydata)) + + mydata <- labelled::set_variable_labels(.data = mydata, + .labels = corrected_labels) + + all_labels <- labelled::var_label(mydata) + + + mytime <- + names(all_labels)[all_labels == self$options$elapsedtime] + + myoutcome <- + names(all_labels)[all_labels == self$options$outcome] + + mydxdate <- + names(all_labels)[all_labels == self$options$dxdate] + + myfudate <- + names(all_labels)[all_labels == self$options$fudate] + + myexplanatory <- + names(all_labels)[all_labels == self$options$explanatory] + + return(list( + "mydata_labelled" = mydata + , "mytime_labelled" = mytime + , "myoutcome_labelled" = myoutcome + , "mydxdate_labelled" = mydxdate + , "myfudate_labelled" = myfudate + , "myexplanatory_labelled" = myexplanatory + )) + + + } + + + + + + , + .todo = function() { - is.null(self$options$contexpl)) { todo <- glue::glue( "
Welcome to ClinicoPath @@ -57,7 +102,6 @@ survivalcontClass <- if (requireNamespace('jmvcore')) html <- self$results$todo html$setContent(todo) - } } diff --git a/R/survivalcont.h.R b/R/survivalcont.h.R index 10a7c291..4497383f 100644 --- a/R/survivalcont.h.R +++ b/R/survivalcont.h.R @@ -28,11 +28,14 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, findcut = FALSE, multievent = FALSE, ci95 = FALSE, - risktable = FALSE, ...) { + risktable = FALSE, + censored = FALSE, ...) { super$initialize( package="ClinicoPath", @@ -57,6 +60,8 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas private$..fudate <- jmvcore::OptionVariable$new( "fudate", fudate) + private$..calculatedtime <- jmvcore::OptionOutput$new( + "calculatedtime") private$..contexpl <- jmvcore::OptionVariable$new( "contexpl", contexpl, @@ -103,8 +108,11 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas analysistype, options=list( "overall", - "cause"), + "cause", + "compete"), default="overall") + private$..outcomeredifened <- jmvcore::OptionOutput$new( + "outcomeredifened") private$..cutp <- jmvcore::OptionString$new( "cutp", cutp, @@ -158,6 +166,14 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas "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, @@ -166,6 +182,8 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas "findcut", findcut, default=FALSE) + private$..calculatedcutoff <- jmvcore::OptionOutput$new( + "calculatedcutoff") private$..multievent <- jmvcore::OptionBool$new( "multievent", multievent, @@ -178,11 +196,16 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas "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) @@ -191,6 +214,7 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas 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) @@ -201,17 +225,22 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas 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, @@ -220,6 +249,7 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas 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, @@ -230,16 +260,21 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas 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), + 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, @@ -248,6 +283,7 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas ..awd = NA, ..awod = NA, ..analysistype = NA, + ..outcomeredifened = NA, ..cutp = NA, ..timetypedata = NA, ..timetypeoutput = NA, @@ -258,11 +294,15 @@ survivalcontOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Clas ..ce = NA, ..ch = NA, ..endplot = NA, + ..ybegin_plot = NA, + ..yend_plot = NA, ..byplot = NA, ..findcut = NA, + ..calculatedcutoff = NA, ..multievent = NA, ..ci95 = NA, - ..risktable = NA) + ..risktable = NA, + ..censored = NA) ) survivalcontResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( @@ -576,7 +616,7 @@ survivalcontBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( pause = NULL, completeWhenFilled = FALSE, requiresMissings = FALSE, - weightsSupport = 'auto') + weightsSupport = 'none') })) #' Survival Analysis for Continuous Variable @@ -605,11 +645,14 @@ survivalcontBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class( #' @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 @@ -662,11 +705,14 @@ survivalcont <- function( ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, findcut = FALSE, multievent = FALSE, ci95 = FALSE, - risktable = FALSE) { + risktable = FALSE, + censored = FALSE) { if ( ! requireNamespace("jmvcore", quietly=TRUE)) stop("survivalcont requires jmvcore to be installed (restart may be required)") @@ -709,11 +755,14 @@ survivalcont <- function( ce = ce, ch = ch, endplot = endplot, + ybegin_plot = ybegin_plot, + yend_plot = yend_plot, byplot = byplot, findcut = findcut, multievent = multievent, ci95 = ci95, - risktable = risktable) + risktable = risktable, + censored = censored) analysis <- survivalcontClass$new( options = options, diff --git a/jamovi/0000.yaml b/jamovi/0000.yaml index 7087e38d..30f0e59d 100644 --- a/jamovi/0000.yaml +++ b/jamovi/0000.yaml @@ -1,12 +1,12 @@ --- title: Common Analysis for Clinicopathological Research name: ClinicoPath -version: 0.0.2.13 +version: 0.0.2.14 jms: '1.0' authors: - Serdar Balci maintainer: Serdar Balci -date: '2023-12-10' +date: '2023-12-11' type: R description: >- ClinicoPath help researchers to generate natural language summaries of their diff --git a/jamovi/multisurvival.a.yaml b/jamovi/multisurvival.a.yaml index bf868ad0..ef82df07 100644 --- a/jamovi/multisurvival.a.yaml +++ b/jamovi/multisurvival.a.yaml @@ -102,10 +102,13 @@ options: name: overall - title: Cause Specific name: cause - # - title: Competing Risk - # name: compete + - title: Competing Risk + name: compete default: overall + - name: outcomeredifened + title: Add Redefined Outcome to Data + type: Output - name: timetypedata @@ -158,6 +161,12 @@ options: type: Integer default: 3 + + - name: calculatedtime + title: Add Calculated Time to Data + type: Output + + - name: hr title: Hazards Regression Plot type: Bool @@ -226,16 +235,6 @@ options: # type: Bool # default: true - # - name: calculatedtime - # title: Add Calculated Time to Data - # type: Output - - # - name: outcomeredifened - # title: Add Redefined Outcome to Data - # type: Output - - - # - name: modelTerms # title: Model Terms diff --git a/jamovi/multisurvival.r.yaml b/jamovi/multisurvival.r.yaml index cb4a3553..923eedf5 100644 --- a/jamovi/multisurvival.r.yaml +++ b/jamovi/multisurvival.r.yaml @@ -219,26 +219,26 @@ items: # - # - name: calculatedtime - # title: Add Calculated Time to Data - # type: Output - # varTitle: '`Calculated Time in Multivariable Survival Function - from ${ dxdate } to { fudate }`' - # varDescription: Calculated Time from given Dates - # clearWith: - # - tint - # - dxdate - # - fudate + - name: calculatedtime + title: Add Calculated Time to Data + type: Output + varTitle: '`Calculated Time in Multivariable Survival Function - from ${ dxdate } to { fudate }`' + varDescription: Calculated Time from given Dates + clearWith: + - tint + - dxdate + - fudate - # - name: outcomeredifened - # title: Add Redefined Outcome to Data - # type: Output - # varTitle: '`Redefined Outcome in Multivariable Survival Function - from ${ outcome } for analysis { analysistype }`' - # varDescription: Redefined Outcome from Outcome based on Analysis Type - # clearWith: - # - outcome - # - analysistype - # - multievent + - name: outcomeredifened + title: Add Redefined Outcome to Data + type: Output + varTitle: '`Redefined Outcome in Multivariable Survival Function - from ${ outcome } for analysis { analysistype }`' + varDescription: Redefined Outcome from Outcome based on Analysis Type + clearWith: + - outcome + - analysistype + - multievent refs: diff --git a/jamovi/multisurvival.u.yaml b/jamovi/multisurvival.u.yaml index 657114ec..26c24398 100644 --- a/jamovi/multisurvival.u.yaml +++ b/jamovi/multisurvival.u.yaml @@ -91,6 +91,8 @@ children: name: landmark format: number enable: (uselandmark) + - type: Output + name: calculatedtime - type: CollapseBox label: Analysis with Multiple Outcomes collapsed: false @@ -141,6 +143,11 @@ children: - type: ComboBox name: sty enable: (hr) + - type: LayoutBox + margin: large + children: + - type: Output + name: outcomeredifened - type: CollapseBox label: Adjusted Survival Curve (Being Updated) collapsed: true diff --git a/jamovi/oddsratio.r.yaml b/jamovi/oddsratio.r.yaml index 8e0c15af..e671203b 100644 --- a/jamovi/oddsratio.r.yaml +++ b/jamovi/oddsratio.r.yaml @@ -13,9 +13,9 @@ items: - outcome - - name: textmydata - title: 'textmydata' - type: Preformatted + # - name: textmydata + # title: 'textmydata' + # type: Preformatted - name: text diff --git a/jamovi/singlearm.a.yaml b/jamovi/singlearm.a.yaml index a9587290..8a6ac724 100644 --- a/jamovi/singlearm.a.yaml +++ b/jamovi/singlearm.a.yaml @@ -58,9 +58,9 @@ options: type: Variable - # - name: calculatedtime - # title: Add Calculated Time to Data - # type: Output + - name: calculatedtime + title: Add Calculated Time to Data + type: Output - name: outcome @@ -102,14 +102,14 @@ options: name: overall - title: Cause Specific name: cause - # - title: Competing Risk - # name: compete + - title: Competing Risk + name: compete default: overall - # - name: outcomeredifened - # title: Add Redefined Outcome to Data - # type: Output + - name: outcomeredifened + title: Add Redefined Outcome to Data + type: Output @@ -199,6 +199,15 @@ options: type: Integer default: 60 + - name: ybegin_plot + title: Start y-axis + type: Number + default: 0.00 + + - name: yend_plot + title: End y-axis + type: Number + default: 1.00 - name: byplot title: Time Interval diff --git a/jamovi/singlearm.u.yaml b/jamovi/singlearm.u.yaml index 55605fb0..ee49a514 100644 --- a/jamovi/singlearm.u.yaml +++ b/jamovi/singlearm.u.yaml @@ -68,6 +68,11 @@ children: isTarget: true fitToGrid: true stretchFactor: 1 + - type: LayoutBox + margin: large + children: + - type: Output + name: calculatedtime - type: Label label: Time Type fitToGrid: true @@ -163,6 +168,17 @@ children: name: risktable - type: CheckBox name: censored + - type: LayoutBox + margin: large + children: + - type: Output + name: outcomeredifened + - type: LayoutBox + margin: large + children: + - type: TextBox + name: ybegin_plot + format: number - type: CollapseBox label: Survival Tables collapsed: true @@ -174,23 +190,9 @@ children: name: cutp format: string width: large - # - type: CollapseBox - # label: Save Converted Variables to Data - # collapsed: true - # children: - # - type: Label - # label: Add Calculated Time to Your Data - # fitToGrid: true - # children: - # - type: Output - # name: calculatedtime - # enable: (tint) - # fitToGrid: true - # - type: Label - # label: Add Redefined Outcome to Data - # fitToGrid: true - # children: - # - type: Output - # name: outcomeredifened - # enable: (multievent) - # fitToGrid: true + - type: LayoutBox + margin: large + children: + - type: TextBox + name: yend_plot + format: number diff --git a/jamovi/survivalcont.a.yaml b/jamovi/survivalcont.a.yaml index 523236d8..f29ac67c 100644 --- a/jamovi/survivalcont.a.yaml +++ b/jamovi/survivalcont.a.yaml @@ -35,6 +35,10 @@ options: title: 'Follow-up Date' type: Variable + - name: calculatedtime + title: Add Calculated Time to Data + type: Output + - name: contexpl title: Continuous Explanatory Variable type: Variable @@ -51,6 +55,7 @@ options: title: Event Level type: Level variable: (outcome) + - name: dod title: Dead of Disease type: Level @@ -80,10 +85,13 @@ options: name: overall - title: Cause Specific name: cause - # - title: Competing Risk - # name: compete + - title: Competing Risk + name: compete default: overall + - name: outcomeredifened + title: Add Redefined Outcome to Data + type: Output - name: cutp title: Cutpoints @@ -142,13 +150,6 @@ options: - - # - name: pw - # title: Pairwise comparisons - # type: Bool - # default: false - - - name: sc title: Survival Plot type: Bool @@ -177,6 +178,15 @@ options: type: Integer default: 60 + - name: ybegin_plot + title: Start y-axis + type: Number + default: 0.00 + + - name: yend_plot + title: End y-axis + type: Number + default: 1.00 - name: byplot title: Time Interval @@ -190,6 +200,10 @@ options: type: Bool default: false + - name: calculatedcutoff + title: Add Calculated Cut-off Group to Data + type: Output + - name: multievent title: Multiple Event Levels @@ -206,24 +220,10 @@ options: type: Bool default: false - - # - name: sas - # title: Single Arm Survival - # type: Bool - # default: false - - # - name: calculatedtime - # title: Add Calculated Time to Data - # type: Output - - # - name: outcomeredifened - # title: Add Redefined Outcome to Data - # type: Output - - - # - name: calculatedcutoff - # title: Add Calculated Cut-off Group to Data - # type: Output + - name: censored + title: censored + type: Bool + default: false ... diff --git a/jamovi/survivalcont.u.yaml b/jamovi/survivalcont.u.yaml index 26c101f3..4e507891 100644 --- a/jamovi/survivalcont.u.yaml +++ b/jamovi/survivalcont.u.yaml @@ -99,6 +99,11 @@ children: enable: (tint) - type: ComboBox name: timetypeoutput + - type: LayoutBox + margin: large + children: + - type: Output + name: calculatedcutoff - type: CollapseBox label: Analysis with Multiple Outcomes collapsed: true @@ -130,6 +135,16 @@ children: - type: ComboBox name: analysistype enable: (outcome && multievent) + - type: LayoutBox + margin: large + children: + - type: Output + name: calculatedtime + - type: LayoutBox + margin: large + children: + - type: Output + name: outcomeredifened - type: LayoutBox margin: large children: @@ -178,12 +193,20 @@ children: - type: CheckBox name: risktable enable: (findcut) + - type: CheckBox + name: censored - type: LayoutBox margin: large children: - type: TextBox name: landmark format: number + - type: LayoutBox + margin: large + children: + - type: TextBox + name: ybegin_plot + format: number - type: CollapseBox label: Survival Tables collapsed: true @@ -196,31 +219,9 @@ children: enable: (findcut) format: string width: large - # - type: CollapseBox - # label: Save Converted Variables to Data - # collapsed: true - # children: - # - type: Label - # label: Add Calculated Time to Your Data - # fitToGrid: true - # children: - # - type: Output - # name: calculatedtime - # enable: (tint) - # fitToGrid: true - # - type: Label - # label: Add Redefined Outcome to Data - # fitToGrid: true - # children: - # - type: Output - # name: outcomeredifened - # enable: (multievent) - # fitToGrid: true - # - type: Label - # label: Add Calculated Cut-off Group to Data - # fitToGrid: true - # children: - # - type: Output - # name: calculatedcutoff - # enable: (findcut) - # fitToGrid: true + - type: LayoutBox + margin: large + children: + - type: TextBox + name: yend_plot + format: number diff --git a/man/multisurvival.Rd b/man/multisurvival.Rd index 8137e6eb..7b94df4f 100644 --- a/man/multisurvival.Rd +++ b/man/multisurvival.Rd @@ -80,6 +80,8 @@ A results object containing: \code{results$text2} \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$calculatedtime} \tab \tab \tab \tab \tab an output \cr +\code{results$outcomeredifened} \tab \tab \tab \tab \tab an output \cr } } \description{ diff --git a/man/oddsratio.Rd b/man/oddsratio.Rd index 04c0ad32..4593b264 100644 --- a/man/oddsratio.Rd +++ b/man/oddsratio.Rd @@ -17,7 +17,6 @@ oddsratio(data, explanatory, outcome) A results object containing: \tabular{llllll}{ \code{results$todo} \tab \tab \tab \tab \tab a html \cr -\code{results$textmydata} \tab \tab \tab \tab \tab a preformatted \cr \code{results$text} \tab \tab \tab \tab \tab a html \cr \code{results$text2} \tab \tab \tab \tab \tab a html \cr \code{results$plot} \tab \tab \tab \tab \tab an image \cr diff --git a/man/singlearm.Rd b/man/singlearm.Rd index 5679947a..27c90b6c 100644 --- a/man/singlearm.Rd +++ b/man/singlearm.Rd @@ -27,6 +27,8 @@ singlearm( ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, multievent = FALSE, ci95 = FALSE, @@ -79,6 +81,10 @@ singlearm( \item{endplot}{.} +\item{ybegin_plot}{.} + +\item{yend_plot}{.} + \item{byplot}{.} \item{multievent}{.} diff --git a/man/survivalcont.Rd b/man/survivalcont.Rd index 7c7b22a4..44dd4533 100644 --- a/man/survivalcont.Rd +++ b/man/survivalcont.Rd @@ -28,11 +28,14 @@ survivalcont( ce = FALSE, ch = FALSE, endplot = 60, + ybegin_plot = 0, + yend_plot = 1, byplot = 12, findcut = FALSE, multievent = FALSE, ci95 = FALSE, - risktable = FALSE + risktable = FALSE, + censored = FALSE ) } \arguments{ @@ -82,6 +85,10 @@ survivalcont( \item{endplot}{.} +\item{ybegin_plot}{.} + +\item{yend_plot}{.} + \item{byplot}{.} \item{findcut}{.} @@ -91,6 +98,8 @@ survivalcont( \item{ci95}{.} \item{risktable}{.} + +\item{censored}{.} } \value{ A results object containing: