We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 552d12a commit 5259c4cCopy full SHA for 5259c4c
1 file changed
analysis/km.R
@@ -470,9 +470,18 @@ if(smooth){
470
km_plot <- function(.data) {
471
472
data_with_time0 <-
473
+ if(length(exposure)>0L){
474
.data |>
475
+ mutate(
476
+ "{exposure}" := as.factor(!!!exposure_syms)
477
+ )
478
+ } else {
479
+ .data
480
+ }
481
+
482
+ data_with_time0 <-
483
+ data_with_time0 |>
484
mutate(
- "{exposure}" := as.factor(!!!exposure_syms),
485
lagtime = lag(time, 1, 0), # assumes the time-origin is zero
486
) %>%
487
group_modify(
@@ -486,6 +495,7 @@ km_plot <- function(.data) {
495
.before = 0
496
)
488
497
498
489
499
ggplot_init <- if(length(exposure)==0L){
490
500
ggplot(data_with_time0)
491
501
} else {
0 commit comments