Skip to content

Commit 654116e

Browse files
committed
v0.0.3.12
preparation for jamovi 2.7 jsurvival_0.0.3.12.jmo
1 parent 426ecb3 commit 654116e

17 files changed

+1119
-83
lines changed

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ jamovi
1414
^_pkgdown\.yml$
1515
^docs$
1616
^pkgdown$
17-
^vignettes$
17+
^vignettes$
18+
vignettes/

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export(oddsratio)
55
export(singlearm)
66
export(survival)
77
export(survivalcont)
8+
export(timeinterval)
89
import(jmvcore)
910
import(magrittr)
1011
importFrom(R6,R6Class)

R/multisurvival.h.R

Lines changed: 315 additions & 37 deletions
Large diffs are not rendered by default.

R/oddsratio.h.R

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ oddsratioResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
6060
text = function() private$.items[["text"]],
6161
text2 = function() private$.items[["text2"]],
6262
plot = function() private$.items[["plot"]],
63-
nomogram = function() private$.items[["nomogram"]],
64-
mydataview_nomogram = function() private$.items[["mydataview_nomogram"]],
65-
plot_nomogram = function() private$.items[["plot_nomogram"]]),
63+
plot_nomogram = function() private$.items[["plot_nomogram"]],
64+
nomogram = function() private$.items[["nomogram"]]),
6665
private = list(),
6766
public=list(
6867
initialize=function(options) {
@@ -106,16 +105,6 @@ oddsratioResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
106105
clearWith=list(
107106
"explanatory",
108107
"outcome")))
109-
self$add(jmvcore::Html$new(
110-
options=options,
111-
name="nomogram",
112-
title="Nomogram",
113-
visible="(showNomogram)"))
114-
self$add(jmvcore::Preformatted$new(
115-
options=options,
116-
name="mydataview_nomogram",
117-
title="Model Details",
118-
visible="(showNomogram)"))
119108
self$add(jmvcore::Image$new(
120109
options=options,
121110
name="plot_nomogram",
@@ -124,6 +113,11 @@ oddsratioResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
124113
height=600,
125114
requiresData=TRUE,
126115
renderFun=".plot_nomogram",
116+
visible="(showNomogram)"))
117+
self$add(jmvcore::Html$new(
118+
options=options,
119+
name="nomogram",
120+
title="Nomogram",
127121
visible="(showNomogram)"))}))
128122

129123
oddsratioBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
@@ -134,7 +128,7 @@ oddsratioBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
134128
super$initialize(
135129
package = "jsurvival",
136130
name = "oddsratio",
137-
version = c(1,0,0),
131+
version = c(0,0,3),
138132
options = options,
139133
results = oddsratioResults$new(options=options),
140134
data = data,
@@ -167,9 +161,8 @@ oddsratioBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
167161
#' \code{results$text} \tab \tab \tab \tab \tab a html \cr
168162
#' \code{results$text2} \tab \tab \tab \tab \tab a html \cr
169163
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
170-
#' \code{results$nomogram} \tab \tab \tab \tab \tab a html \cr
171-
#' \code{results$mydataview_nomogram} \tab \tab \tab \tab \tab a preformatted \cr
172164
#' \code{results$plot_nomogram} \tab \tab \tab \tab \tab an image \cr
165+
#' \code{results$nomogram} \tab \tab \tab \tab \tab a html \cr
173166
#' }
174167
#'
175168
#' @export

R/singlearm.h.R

Lines changed: 119 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
3434
ci95 = FALSE,
3535
risktable = FALSE,
3636
censored = FALSE,
37-
medianline = "none", ...) {
37+
medianline = "none",
38+
person_time = FALSE,
39+
time_intervals = "12, 36, 60",
40+
rate_multiplier = 100, ...) {
3841

3942
super$initialize(
4043
package="jsurvival",
@@ -195,6 +198,18 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
195198
"v",
196199
"hv"),
197200
default="none")
201+
private$..person_time <- jmvcore::OptionBool$new(
202+
"person_time",
203+
person_time,
204+
default=FALSE)
205+
private$..time_intervals <- jmvcore::OptionString$new(
206+
"time_intervals",
207+
time_intervals,
208+
default="12, 36, 60")
209+
private$..rate_multiplier <- jmvcore::OptionInteger$new(
210+
"rate_multiplier",
211+
rate_multiplier,
212+
default=100)
198213

199214
self$.addOption(private$..elapsedtime)
200215
self$.addOption(private$..tint)
@@ -227,6 +242,9 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
227242
self$.addOption(private$..risktable)
228243
self$.addOption(private$..censored)
229244
self$.addOption(private$..medianline)
245+
self$.addOption(private$..person_time)
246+
self$.addOption(private$..time_intervals)
247+
self$.addOption(private$..rate_multiplier)
230248
}),
231249
active = list(
232250
elapsedtime = function() private$..elapsedtime$value,
@@ -259,7 +277,10 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
259277
ci95 = function() private$..ci95$value,
260278
risktable = function() private$..risktable$value,
261279
censored = function() private$..censored$value,
262-
medianline = function() private$..medianline$value),
280+
medianline = function() private$..medianline$value,
281+
person_time = function() private$..person_time$value,
282+
time_intervals = function() private$..time_intervals$value,
283+
rate_multiplier = function() private$..rate_multiplier$value),
263284
private = list(
264285
..elapsedtime = NA,
265286
..tint = NA,
@@ -291,7 +312,10 @@ singlearmOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
291312
..ci95 = NA,
292313
..risktable = NA,
293314
..censored = NA,
294-
..medianline = NA)
315+
..medianline = NA,
316+
..person_time = NA,
317+
..time_intervals = NA,
318+
..rate_multiplier = NA)
295319
)
296320

297321
singlearmResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
@@ -303,6 +327,8 @@ singlearmResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
303327
medianTable = function() private$.items[["medianTable"]],
304328
survTableSummary = function() private$.items[["survTableSummary"]],
305329
survTable = function() private$.items[["survTable"]],
330+
personTimeTable = function() private$.items[["personTimeTable"]],
331+
personTimeSummary = function() private$.items[["personTimeSummary"]],
306332
plot = function() private$.items[["plot"]],
307333
plot2 = function() private$.items[["plot2"]],
308334
plot3 = function() private$.items[["plot3"]],
@@ -446,6 +472,76 @@ singlearmResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
446472
"dxdate",
447473
"tint",
448474
"multievent")))
475+
self$add(jmvcore::Table$new(
476+
options=options,
477+
name="personTimeTable",
478+
title="Person-Time Analysis",
479+
visible="(person_time)",
480+
rows=0,
481+
columns=list(
482+
list(
483+
`name`="interval",
484+
`title`="Time Interval",
485+
`type`="text"),
486+
list(
487+
`name`="events",
488+
`title`="Events",
489+
`type`="integer"),
490+
list(
491+
`name`="person_time",
492+
`title`="Person-Time",
493+
`type`="number",
494+
`format`="zto"),
495+
list(
496+
`name`="rate",
497+
`title`="Incidence Rate",
498+
`type`="number",
499+
`format`="zto"),
500+
list(
501+
`name`="rate_ci_lower",
502+
`title`="Lower",
503+
`superTitle`="95% CI",
504+
`type`="number",
505+
`format`="zto"),
506+
list(
507+
`name`="rate_ci_upper",
508+
`title`="Upper",
509+
`superTitle`="95% CI",
510+
`type`="number",
511+
`format`="zto")),
512+
clearWith=list(
513+
"outcome",
514+
"outcomeLevel",
515+
"elapsedtime",
516+
"rate_multiplier",
517+
"time_intervals",
518+
"person_time",
519+
"outcome",
520+
"outcomeLevel",
521+
"overalltime",
522+
"fudate",
523+
"dxdate",
524+
"tint",
525+
"multievent")))
526+
self$add(jmvcore::Html$new(
527+
options=options,
528+
name="personTimeSummary",
529+
title="Person-Time Summary",
530+
visible="(person_time)",
531+
clearWith=list(
532+
"outcome",
533+
"outcomeLevel",
534+
"elapsedtime",
535+
"rate_multiplier",
536+
"time_intervals",
537+
"person_time",
538+
"outcome",
539+
"outcomeLevel",
540+
"overalltime",
541+
"fudate",
542+
"dxdate",
543+
"tint",
544+
"multievent")))
449545
self$add(jmvcore::Image$new(
450546
options=options,
451547
name="plot",
@@ -572,7 +668,7 @@ singlearmBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
572668
super$initialize(
573669
package = "jsurvival",
574670
name = "singlearm",
575-
version = c(1,0,0),
671+
version = c(0,0,3),
576672
options = options,
577673
results = singlearmResults$new(options=options),
578674
data = data,
@@ -701,13 +797,24 @@ singlearmBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
701797
#' ticks on the survival curves.
702798
#' @param medianline If true, displays a line indicating the median survival
703799
#' time on the survival plot.
800+
#' @param person_time Enable this option to calculate and display person-time
801+
#' metrics, including total follow-up time and incidence rates. These metrics
802+
#' help quantify the rate of events per unit of time in your study population.
803+
#' @param time_intervals Specify time intervals for stratified person-time
804+
#' analysis. Enter a comma-separated list of time points to create intervals.
805+
#' For example, "12, 36, 60" will create intervals 0-12, 12-36, 36-60, and
806+
#' 60+.
807+
#' @param rate_multiplier Specify the multiplier for incidence rates (e.g.,
808+
#' 100 for rates per 100 person-years, 1000 for rates per 1000 person-years).
704809
#' @return A results object containing:
705810
#' \tabular{llllll}{
706811
#' \code{results$todo} \tab \tab \tab \tab \tab a html \cr
707812
#' \code{results$medianSummary} \tab \tab \tab \tab \tab a preformatted \cr
708813
#' \code{results$medianTable} \tab \tab \tab \tab \tab a table \cr
709814
#' \code{results$survTableSummary} \tab \tab \tab \tab \tab a preformatted \cr
710815
#' \code{results$survTable} \tab \tab \tab \tab \tab a table \cr
816+
#' \code{results$personTimeTable} \tab \tab \tab \tab \tab a table \cr
817+
#' \code{results$personTimeSummary} \tab \tab \tab \tab \tab a html \cr
711818
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
712819
#' \code{results$plot2} \tab \tab \tab \tab \tab an image \cr
713820
#' \code{results$plot3} \tab \tab \tab \tab \tab an image \cr
@@ -753,7 +860,10 @@ singlearm <- function(
753860
ci95 = FALSE,
754861
risktable = FALSE,
755862
censored = FALSE,
756-
medianline = "none") {
863+
medianline = "none",
864+
person_time = FALSE,
865+
time_intervals = "12, 36, 60",
866+
rate_multiplier = 100) {
757867

758868
if ( ! requireNamespace("jmvcore", quietly=TRUE))
759869
stop("singlearm requires jmvcore to be installed (restart may be required)")
@@ -800,7 +910,10 @@ singlearm <- function(
800910
ci95 = ci95,
801911
risktable = risktable,
802912
censored = censored,
803-
medianline = medianline)
913+
medianline = medianline,
914+
person_time = person_time,
915+
time_intervals = time_intervals,
916+
rate_multiplier = rate_multiplier)
804917

805918
analysis <- singlearmClass$new(
806919
options = options,

0 commit comments

Comments
 (0)