Skip to content

survminer 0.4.0

Compare
Choose a tag to compare
@kassambara kassambara released this 07 Jun 20:54
· 170 commits to master since this release

New features

New options in ggsurvplot()

  • New argument test.for.trend added in ggsurvplot() to perform a log-rank test for trend. logical value. Default is FALSE. If TRUE, returns the test for trend p-values. Tests for trend are designed to detect ordered differences in survival curves. That is, for at least one group. The test for trend can be only performed when the number of groups is > 2 (#188).

  • New argument add.all added now in ggsurvplot() to add he survival curves of (all) pooled patients onto the main survival plot stratified by grouping variables. Alias of the ggsurvplot_add_all() function (#194).

  • New argument combine = TRUE is now available in the ggsurvplot() function to combine a list of survfit objects on the same plot. Alias of the ggsurvplot_combine() function (#195).

  • The standard convention of ggplot2 is to have the axes offset from the origin. This can be annoying with Kaplan-Meier plots. New argument axes.offset added non in ggsurvplot(). logical value. Default is TRUE. If FALSE, set the plot axes to start at the origin (c(0,0)) (#196).

  • The function ggsurvplot() can take a list of survfit objects and produces a list of ggsurvplots (#204).

  • New argument facet.by added now in ggsurvplot() to draw multi-panel survival curves of a data set grouped by one or two variables. Alias of the ggsurvplot_facet() function (#205).

  • New argument group.by added now in ggsurvplot() to create survival curves of grouped data sets. Alias of the ggsurvplot_group_by() function.

  • In ggsurvplot(), one can specify pval = TRUE/FALSE as a logical value. Now, it's also possible to specify the argument pval as a numeric value (e.g.: pval = 0.002), that will be passed to the plot, so that user can pass any custom p-value to the final plot (@MarcinKosinski, #189) or one can specify it as a character string (e.g.: pval = "p < 0001") (@MarcinKosinski, #193).

  • New argument xscale in ggsurvplot(): numeric or character value specifying x-axis scale.

    • If numeric, the value is used to divide the labels on the x axis. For example, a value of 365.25 will give labels in years instead of the original days.
    • If character, allowed options include one of c("d_m", "d_y", "m_d", "m_y", "y_d", "y_m"), where d = days, m = months and y = years. For example, xscale = "d_m" will transform labels from days to months; xscale = "m_y", will transform labels from months to years (#166).
  • New arguments censor.shape and censor.size to change the shape and the shape of censors (#186 & #187).

  • New argument conf.int.alpha added in ggsurvplot(). Numeric value specifying fill color transparency. Value should be in [0, 1], where 0 is full transparency and 1 is no transparency.

New functions

  • New function surv_group_by() added to create a grouped data set for survival analysis.

  • New function ggsurvplot_df() added. An extension to ggsurvplot() to plot survival curves from any data frame containing the summary of survival curves as returned the surv_summary() function. Might be useful for a user who wants to use ggsurvplot for visualizing survival curves computed by another method than the standard survfit.formula function. In this case, the user has just to provide the data frame containing the summary of the survival analysis.

  • New function surv_median() added to easily extract median survivals from one or a list of survfit objects (#207).

  • New function surv_pvalue() added to compute p-value from survfit objects or parse it when provided by the user. Survival curves are compared using the log-rank test (default). Other methods can be specified using the argument method.

  • New function surv_fit() added to handle complex situation when computing survival curves (Read more in the doc: ?surv_fit). Wrapper arround the standard survfit() [survival] function to create survival curves. Compared to the standard survfit() function, it supports also:

    • a list of data sets and/or a list of formulas,
    • a grouped data sets as generated by the function surv_group_by,
    • group.by option

Major changes

  • The ggforest() function has changed a lot. Now presents much more statistics for each level of each variable (extracted with broom::tidy) and also some statistics for the coxph model, like AIC, p.value, concordance (extracted with broom::glance) (#178)

Minor changes

  • Now, ggcompetingrisks() supports the conf.int argument. If conf.int=TRUE and fit is an object of class cuminc then confidence intervals are plotted with geom_ribbon.

  • Now, ggsurvplot() supports the survfit() outputs when used with the argument start.time.

  • Now, the default behaviour of ggsurvplot() is to round the number at risk using the option digits = 0 (214).

  • pairwise_survdiff() has been improved to handle a formula with multiple variables (213).

  • The argument color are updated allowing to assign the same color for same groups accross facets (#99 & #185).

    • If the number of strata/group (n.strata) = 1, the expected value is the color name. For example color = "blue".
    • If n.strata > 1, the expected value is the grouping variable name. By default, survival curves are colored by strata using the argument color = "strata", but you can also color survival curves by any other grouping variables used to fit the survival curves.

For example, in the following script, survival curves are colored by the grouping variable sex in all facets:

library(survminer)
library(survival)
fit <- survfit( Surv(time, status) ~ sex + rx + adhere,
                 data = colon )
ggsurv <- ggsurvplot(fit, data = colon,
               color = "sex",
               legend.title = "Sex",
               palette = "jco")
ggsurv$plot + facet_grid(rx ~ adhere)
  • Now, the function pairwise_survdiff() checks whether the grouping variable is a factor. If this is not the case, the grouping variable is automatically converted into a factor.

  • ggsurvplot(): Now, log scale is used for x-axis when plotting the complementary log−log function (argument `fun = "cloglog") (#171).

  • Now, the argument palette in ggsurvplot() ccan be also a numeric vector of length(strata); in this case a basic color palette is created using the function grDevices::palette().

  • The %+% function in survminer has been replaced by %++% to avoid breaking the ggplot2::%+% function behavior when using survminer (#199 and #200).

  • New argument fun added in ggcoxadjustedcurves() (@meganli, #202).

  • The function theme_classic2() removed.

Bug fixes

  • Columns/Rows are now correctly labeled in pairwise_survdiff() display (@mriffle, #212).

  • Now, the pairwise_survdiff() function works when the data contain NAs (@emilelatour , #184).

  • Now, ggsurvplot() fully supports different methods, in the survMisc package, for comparing survival curves (#191).