Skip to content

Commit

Permalink
color order: Landmark analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jinseob2kim committed Jul 18, 2023
1 parent c4ade47 commit b2e78d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: jskm
Title: Kaplan-Meier Plot with 'ggplot2'
Version: 0.5
Date: 2023-03-18
Version: 0.5.1
Date: 2023-07-18
Authors@R: c(person("Jinseob", "Kim", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")),
person("Zarathu", role = c("cph", "fnd"))
)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# jskm 0.5.1

* Fix: line color problem when apply landmark analysis

# jskm 0.5

* Add competing risk analysis to `jskm`
Expand Down
6 changes: 3 additions & 3 deletions R/jskm.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jskm <- function(sfit,
}

df11 <- rbind(subset(df, time < cut.landmark), df2[, names(df)])
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))
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))
} else{
if (is.null(status.cmprsk)){
status.cmprsk <- sfit$states[2]
Expand All @@ -268,7 +268,7 @@ jskm <- function(sfit,
by = c("time", "strata"))
}
df11 <- rbind(subset(df, time < cut.landmark), df2[, names(df)])
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))
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))
}


Expand Down Expand Up @@ -353,7 +353,7 @@ jskm <- function(sfit,
} else{
p <- p +
scale_linetype_manual(name = ystrataname, values=linetype) +
geom_step(data = subset(df, time < cut.landmark), linewidth = 0.75) + geom_step(data = subset(df, time >= cut.landmark), linewidth = 0.75) +
geom_step(data = subset(df, time >= cut.landmark), linewidth = 0.75) + geom_step(data = subset(df, time < cut.landmark), linewidth = 0.75) +
scale_colour_brewer(name = ystrataname, palette=linecols)
}

Expand Down

0 comments on commit b2e78d4

Please sign in to comment.