Skip to content

Commit b2e78d4

Browse files
committed
color order: Landmark analysis
1 parent c4ade47 commit b2e78d4

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: jskm
22
Title: Kaplan-Meier Plot with 'ggplot2'
3-
Version: 0.5
4-
Date: 2023-03-18
3+
Version: 0.5.1
4+
Date: 2023-07-18
55
Authors@R: c(person("Jinseob", "Kim", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")),
66
person("Zarathu", role = c("cph", "fnd"))
77
)

NEWS.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# jskm 0.5.1
2+
3+
* Fix: line color problem when apply landmark analysis
4+
15
# jskm 0.5
26

37
* Add competing risk analysis to `jskm`

R/jskm.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ jskm <- function(sfit,
250250
}
251251

252252
df11 <- rbind(subset(df, time < cut.landmark), df2[, names(df)])
253-
df <- rbind(df11, data.frame(time = cut.landmark, n.risk = summary(sfit, times = cut.landmark)$n.risk[[1]], n.event = 0, n.censor = 0, surv = 1, strata = factor(ystratalabs, levels = levels(df$strata)), upper = 1, lower = 1))
253+
df <- rbind(df11, data.frame(time = cut.landmark, n.risk = summary(sfit, times = cut.landmark)$n.risk[[1]], n.event = 0, n.censor = 0, surv = 1, strata = levels(df$strata), upper = 1, lower = 1))
254254
} else{
255255
if (is.null(status.cmprsk)){
256256
status.cmprsk <- sfit$states[2]
@@ -268,7 +268,7 @@ jskm <- function(sfit,
268268
by = c("time", "strata"))
269269
}
270270
df11 <- rbind(subset(df, time < cut.landmark), df2[, names(df)])
271-
df <- rbind(df11, data.frame(time = cut.landmark, n.risk = summary(sfit, times = cut.landmark)$n.risk[[1]], n.event = 0, n.censor = 0, surv = 0, strata = factor(ystratalabs, levels = levels(df$strata)), upper = 0, lower = 0))
271+
df <- rbind(df11, data.frame(time = cut.landmark, n.risk = summary(sfit, times = cut.landmark)$n.risk[[1]], n.event = 0, n.censor = 0, surv = 0, strata = levels(df$strata), upper = 0, lower = 0))
272272
}
273273

274274

@@ -353,7 +353,7 @@ jskm <- function(sfit,
353353
} else{
354354
p <- p +
355355
scale_linetype_manual(name = ystrataname, values=linetype) +
356-
geom_step(data = subset(df, time < cut.landmark), linewidth = 0.75) + geom_step(data = subset(df, time >= cut.landmark), linewidth = 0.75) +
356+
geom_step(data = subset(df, time >= cut.landmark), linewidth = 0.75) + geom_step(data = subset(df, time < cut.landmark), linewidth = 0.75) +
357357
scale_colour_brewer(name = ystrataname, palette=linecols)
358358
}
359359

0 commit comments

Comments
 (0)