diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index baaee1b..0000000 --- a/docs/404.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - -Page not found (404) • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -Content not found. Please use links in the navbar. - -
- - - -
- - - - -
- - - - - - - - diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html deleted file mode 100644 index fe9b73d..0000000 --- a/docs/ISSUE_TEMPLATE.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - -NA • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - - -
-

-Expected behavior

-
-
-

-Actual behavior

-
-
-

-Steps to reproduce the problem

-
- - - -
- - - -
- - - - -
- - - - - - - - diff --git a/docs/articles/Informative_Survival_Plots.html b/docs/articles/Informative_Survival_Plots.html deleted file mode 100644 index 145e25e..0000000 --- a/docs/articles/Informative_Survival_Plots.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - -Survival plots have never been so informative • survminer - - - - - - - - - - -
-
- - - - -
-
- - - - -

-
-

This vignette covers changes between versions 0.1.0 and 0.2.0.

-
-
-

-Motivation

-

Hadley Wickham’s ggplot2 version 2.0 revolution, at the end of 2015, triggered many crashes in dependent R packages, that finally led to deletions of few packages from The Comprehensive R Archive Network. It occured that survMisc package was removed from CRAN on 27th of January 2016 and R world remained helpless in the struggle with the elegant visualizations of survival analysis. Then a new tool - survminer package, created by Alboukadel Kassambara - appeared on the R survival scene to fill the gap in visualizing the Kaplan-Meier estimates of survival curves in elegant grammar of graphics like way. This blog presents main features of core ggsurvplot() function from survminer package, which creates the most informative, elegant and flexible survival plots that I have seen!

-

During the development of RTCGA package (about which I wrote here) we encountered a need to provide the simplest possible interface to estimates of survival curves for biotechnologists and the discovery of ggsurvplot() was a bull’s-eye! Many have tried to provide a package or function for ggplot2-like plots that would present the basic tool of survival analysis: Kaplan-Meier estimates of survival curves, but none of earlier attempts have provided such a rich structure of features and flexibility as survminer. On basis of estimates of survival curves one can infere on differences in survival times between compared groups, so survival plots are very useful and can be seen in almost every publication in the field of survival analysis and time to event models.

-
-
-

-Example

-

After regular installation

-
install.packages('survminer')
-BiocManager::install("RTCGA.clinical") # data for examples
-

we can create simple estimates of survival curves just after we put survfit (survival package) object into ggsurvplot() function. Let’s have a look at differences in survival times between patients suffering from Ovarian Cancer (Ovarian serous cystadenocarcinoma) and patients suffering from Breast Cancer (Breast invasive carcinoma), where data were collected by The Cancer Genome Atlas Project.

-
library(survminer)
-library(RTCGA.clinical)
-survivalTCGA(BRCA.clinical, OV.clinical,
-             extract.cols = "admin.disease_code") -> BRCAOV.survInfo
-library(survival)
-fit <- survfit(Surv(times, patient.vital_status) ~ admin.disease_code,
-               data = BRCAOV.survInfo)
-# Visualize with survminer
-ggsurvplot(fit, data = BRCAOV.survInfo, risk.table = TRUE)
-

-

This simple plot presents, in an elegant way, estimates of survival probability depending on days from cancer diagnostics grouped by cancer types and an informative risk set table, which shows the number of patients that were under observation in the specific period of time. Survival analysis is a specific field of data analysis because of the censored time to event data, so risk set size is a must in visual inference.

-

After few improvements (#1, #2, #3, #4, #7, #8, #12, #28), made by Alboukadel in version 0.2.0, one can create a powerful, informative survival plot with such specification of parameters

-
ggsurvplot(
-   fit,                     # survfit object with calculated statistics.
-   data = BRCAOV.survInfo,  # data used to fit survival curves. 
-   risk.table = TRUE,       # show risk table.
-   pval = TRUE,             # show p-value of log-rank test.
-   conf.int = TRUE,         # show confidence intervals for 
-                            # point estimaes of survival curves.
-   xlim = c(0,2000),        # present narrower X axis, but not affect
-                            # survival estimates.
-   break.time.by = 500,     # break X axis in time intervals by 500.
-   ggtheme = theme_minimal(), # customize plot and risk table with a theme.
- risk.table.y.text.col = T, # colour risk table text annotations.
-  risk.table.y.text = FALSE # show bars instead of names in text annotations
-                            # in legend of risk table
-)
-

-

Each parameter is described in the correspoding comment, but I would like to emphasize the xlim parameter which controls limits of the X axis but does not affect the survival curves, that are taking into account all possible times. Another brilliant parameter is break.time.by that affects survival plots and the risk set table - this would not be so easy to create it by yourself. Also a ggtheme parameter is beneficial for simple plot customization. Finally, risk.table.y.text and risk.table.y.text.col (for which I have provided a user requests) are useful parameters that change text (often too long and redundand) from risk table legend into narrow, coloured bar. This saves a lot of space in the final plot.

-
-
-

-Comparisons

-

Even though survMisc have returned on CRAN, I’ve appreciated survminer so much that I would not look anymore for other solutions. Check why: at the end I present survival curves that can be obtained with the usage of base package and survMisc package.

-
-

-base package

-
plot(fit) # base
-

-

It looks pretty… base…

-
plot(fit, col=c("orange","purple"), lty=c(1:2), lwd=3, # base with some customization
-     conf.int = TRUE, xmax = 2000)
-# add a legend
-legend(100, .2, c("Ovarian Cancer", "Breast Cancer"),
-       lty = c(1:2), col=c("orange","purple"))
-

-

I haven’t seen examples with risk table and adding legend isn’t so quick as in survminer. Moreover, there are no minor axis breaks lines.

-
-
-

-survMisc package

-
# install.packages('survMisc')
-library(survMisc)
-survMisc:::autoplot.survfit(fit) # no customization
-

Why colours are not asigned to any group? Where is the legend? Why there is so much white space to the right? (Those were questions for the version of survMisc where this was an issue.) Where is OX axis?

-
survMisc:::autoplot.survfit( # with some hard customization
-   fit,
-   type = "fill",
-   pVal=TRUE
-) -> fit.survMisc
-fit.survMisc$table <- fit.survMisc$table +
-   theme_minimal() + # theme(legend.position = "top")
-   coord_cartesian(xlim = c(0,2000))
-fit.survMisc$plot <- fit.survMisc$plot +
-   theme_minimal() +
-   coord_cartesian(xlim = c(0,2000))
-survMisc:::print.tableAndPlot(fit.survMisc)
-

Where is risk table? Why I can’t pass break.by.time to have informative minor X axis breaks? Why the plot gets narrower when the legend in risk table gets wider and why I can’t do anything to workaround this?

-
-

Never mind -> install.packages('survminer')

-
-
-
-
- - - -
- - - - -
- - - - - - diff --git a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index 11fcb98..0000000 Binary files a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index cd1edb6..0000000 Binary files a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index f7153b0..0000000 Binary files a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index 29109b9..0000000 Binary files a/docs/articles/Informative_Survival_Plots_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts.html b/docs/articles/Playing_with_fonts_and_texts.html deleted file mode 100644 index 40dd1ff..0000000 --- a/docs/articles/Playing_with_fonts_and_texts.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - -Playing with fonts and texts • survminer - - - - - - - - - - -
-
- - - - -
-
- - - - -
library("survminer")
-
-

This vignette covers changes between versions 0.2.4 and 0.2.5 for additional texts and fonts customization enabled for subtitles and captions.

-
-
-

-Survival plot

-
-

-Basic

-

Compare the basic plot

-
library("survival")
-fit<- survfit(Surv(time, status) ~ sex, data = lung)
-
-# Drawing survival curves
-ggsurvplot(fit, data = lung)
-

-
-
-

-Customized

-

with the plot where every possible text on a plot is specified

-
ggsurvplot(fit, data = lung,
-   title = "Survival curves", subtitle = "Based on Kaplan-Meier estimates",
-   caption = "created with survminer",
-   font.title = c(16, "bold", "darkblue"),
-   font.subtitle = c(15, "bold.italic", "purple"),
-   font.caption = c(14, "plain", "orange"),
-   font.x = c(14, "bold.italic", "red"),
-   font.y = c(14, "bold.italic", "darkred"),
-   font.tickslab = c(12, "plain", "darkgreen"))
-

-
-
-
-

-Risk table

-

Now allow risk.table to be displayed.

-
-

-Basic

-

Please compare basic plot with a risk table

-
ggsurvplot(fit, data = lung, risk.table = TRUE)
-

-
-
-

-Customized

-

with the plot where every possible text on a plot and table is specified

-
ggsurvplot(fit, data = lung,
-   title = "Survival curves", subtitle = "Based on Kaplan-Meier estimates",
-   caption = "created with survminer",
-   font.title = c(16, "bold", "darkblue"),
-   font.subtitle = c(15, "bold.italic", "purple"),
-   font.caption = c(14, "plain", "orange"),
-   font.x = c(14, "bold.italic", "red"),
-   font.y = c(14, "bold.italic", "darkred"),
-   font.tickslab = c(12, "plain", "darkgreen"),
-   ########## risk table #########,
-   risk.table = TRUE,
-   risk.table.title = "Note the risk set sizes",
-   risk.table.subtitle = "and remember about censoring.",
-   risk.table.caption = "source code: website.com",
-   risk.table.height = 0.45)
-

-
-
-
-

-ncens plot

-

Finally, allow ncens.plot to be displayed.

-
-

-Basic

-

Please compare basic plot with a risk table and a ncens plot

-
ggsurvplot(fit, data = lung, risk.table = TRUE, ncensor.plot = TRUE)
-

-
-
-

-Customized

-

with the full customization

-
ggsurvplot(fit, data = lung,
-   title = "Survival curves", subtitle = "Based on Kaplan-Meier estimates",
-   caption = "created with survminer",
-   font.title = c(16, "bold", "darkblue"),
-   font.subtitle = c(15, "bold.italic", "purple"),
-   font.caption = c(14, "plain", "orange"),
-   font.x = c(14, "bold.italic", "red"),
-   font.y = c(14, "bold.italic", "darkred"),
-   font.tickslab = c(12, "plain", "darkgreen"),
-   ########## risk table #########,
-   risk.table = TRUE,
-   risk.table.title = "Note the risk set sizes",
-   risk.table.subtitle = "and remember about censoring.",
-   risk.table.caption = "source code: website.com",
-   risk.table.height = 0.35,
-   ncensor.plot = TRUE,
-   ncensor.plot.title = "Number of censorings",
-   ncensor.plot.subtitle = "over the time.",
-   ncensor.plot.caption = "data available at data.com",
-   ncensor.plot.height = 0.35)
-

-
-
-
-

-Notes

-
    -
  • Note that you will probably need to extend the default risk table height and ncens plot height after those customizations.
  • -
  • Distinct between title and subtitle for the curve_plot and risk.table.title and risk.table.subtitle for the table / ncens.plot.title and ncens.plot.subtitle for the ncens.
  • -
  • Fonts are set simultaneously for the curve_plot, for the table and for the ncens parts. This might change in the future.
  • -
-
-
- - - -
- - - - -
- - - - - - diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-3-1.png deleted file mode 100644 index 737af5b..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-3-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index be0f7ef..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index c33a36e..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index c7e157e..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index 8f9dae1..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-8-1.png deleted file mode 100644 index 9ee8cf5..0000000 Binary files a/docs/articles/Playing_with_fonts_and_texts_files/figure-html/unnamed-chunk-8-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons.html b/docs/articles/Specifiying_weights_in_log-rank_comparisons.html deleted file mode 100644 index 60badec..0000000 --- a/docs/articles/Specifiying_weights_in_log-rank_comparisons.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - -Specifiyng weights in Log-rank comparisons • survminer - - - - - - - - - - -
-
- - - - -
-
- - - - -
library("survminer")
-
-

This vignette covers changes between versions 0.2.4 and 0.2.5 for specifiyng weights in the log-rank comparisons done in ggsurvplot().

-
-
-

-Log-rank statistic for 2 groups

-

As it is stated in the literature, the Log-rank test for comparing survival (estimates of survival curves) in 2 groups (\(A\) and \(B\)) is based on the below statistic

-

\[LR = \frac{U^2}{V} \sim \chi(1),\]

-

where \[U = \sum_{i=1}^{T}w_{t_i}(o_{t_i}^A-e_{t_i}^A), \ \ \ \ \ \ \ \ V = Var(U) = \sum_{i=1}^{T}(w_{t_i}^2\frac{n_{t_i}^An_{t_i}^Bo_{t_i}(n_{t_i}-o_{t_i})}{n_{t_i}^2(n_{t_i}-1)})\] and

-
    -
  • -\(t_i\) for \(i=1, \dots, T\) are possible event times,
  • -
  • -\(n_{t_i}\) is the overall risk set size on the time \(t_i\) (\(n_{t_i} = n_{t_i}^A+n_{t_i}^B\)),
  • -
  • -\(n_{t_i}^A\) is the risk set size on the time \(t_i\) in group \(A\),
  • -
  • -\(n_{t_i}^B\) is the risk set size on the time \(t_i\) in group \(B\),
  • -
  • -\(o_{t_i}\) overall observed events in the time \(t_i\) (\(o_{t_i} = o_{t_i}^A+o_{t_i}^B\)),
  • -
  • -\(o_{t_i}^A\) observed events in the time \(t_i\) in group \(A\),
  • -
  • -\(o_{t_i}^B\) observed events in the time \(t_i\) in group \(B\),
  • -
  • -\(e_{t_i}\) number of overall expected events in the time \(t_i\) (\(e_{t_i} = e_{t_i}^A+e_{t_i}^B\)),
  • -
  • -\(e_{t_i}^A\) number of expected events in the time \(t_i\) in group \(A\),
  • -
  • -\(e_{t_i}^B\) number of expected events in the time \(t_i\) in group \(B\),
  • -
  • -\(w_{t_i}\) is a weight for the statistic,
  • -
-

also remember about few notes

-

\[e_{t_i}^A = n_{t_i}^A \frac{o_{t_i}}{n_{t_i}}, \ \ \ \ \ \ \ \ \ \ e_{t_i}^B = n_{t_i}^B \frac{o_{t_i}}{n_{t_i}},\] \[e_{t_i}^A + e_{t_i}^B = o_{t_i}^A + o_{t_i}^B\]

-

that’s why we can substitute group \(A\) with \(B\) in \(U\) and receive same results.

-
-
-

-Weighted Log-rank extensions

-

Regular Log-rank comparison uses \(w_{t_i} = 1\) but many modifications to that approach have been proposed. The most popular modifications, called weighted Log-rank tests, are available in ?survMisc::comp

-
    -
  • -n Gehan and Breslow proposed to use \(w_{t_i} = n_{t_i}\) (this is also called generalized Wilcoxon),
  • -
  • -srqtN Tharone and Ware proposed to use \(w_{t_i} = \sqrt{n_{t_i}}\),
  • -
  • -S1 Peto-Peto’s modified survival estimate \(w_{t_i} = S1({t_i}) = \prod_{i=1}^{T}(1-\frac{e_{t_i}}{n_{t_i}+1})\),
  • -
  • -S2 modified Peto-Peto (by Andersen) \(w_{t_i} = S2({t_i}) = \frac{S1({t_i})n_{t_i}}{n_{t_i}+1}\),
  • -
  • -FH Fleming-Harrington \(w_{t_i} = S(t_i)^p(1 - S(t_i))^q\).
  • -
-
-

Watch out for FH as I submitted an info on survMisc repository where I think their mathematical notation is misleading for Fleming-Harrington.

-
-
-

-Why are they useful?

-

The regular Log-rank test is sensitive to detect differences in late survival times, where Gehan-Breslow and Tharone-Ware propositions might be used if one is interested in early differences in survival times. Peto-Peto modifications are also useful in early differences and are more robust (than Tharone-Whare or Gehan-Breslow) for situations where many observations are censored. The most flexible is Fleming-Harrington method for weights, where high p indicates detecting early differences and high q indicates detecting differences in late survival times. But there is always an issue on how to detect p and q.

-
-

Remember that test selection should be performed at the research design level! Not after looking in the dataset.

-
-
-
-
-

-Plots

-
library("survival")
-data("lung")
-fit <- survfit(Surv(time, status) ~ sex, data = lung)
-

After preparing a functionality for this GitHub’s issue Other tests than log-rank for testing survival curves and Log-rank test for trend we are now able to compute p-values for various Log-rank test in survminer package. Let as see below examples on executing all possible tests.

-
-

-Log-rank (survdiff)

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE)
-

-
-
-

-Log-rank (comp)

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "1")
-

-
-
-

-Gehan-Breslow (generalized Wilcoxon)

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "n", pval.method.coord = c(5, 0.1),
-           pval.method.size = 3)
-

-
-
-

-Tharone-Ware

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "sqrtN", pval.method.coord = c(3, 0.1),
-           pval.method.size = 4)
-

-
-
-

-Peto-Peto’s modified survival estimate

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "S1", pval.method.coord = c(5, 0.1),
-           pval.method.size = 3)
-

-
-
-

-modified Peto-Peto’s (by Andersen)

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "S2", pval.method.coord = c(5, 0.1),
-           pval.method.size = 3)
-

-
-
-

-Fleming-Harrington (p=1, q=1)

-
ggsurvplot(fit, data = lung, pval = TRUE, pval.method = TRUE,
-           log.rank.weights = "FH_p=1_q=1",
-           pval.method.coord = c(5, 0.1),
-           pval.method.size = 4)
-

-
-
-
-

-References

-
    -
  • Gehan A. A Generalized Wilcoxon Test for Comparing Arbitrarily Singly-Censored Samples. Biometrika 1965 Jun. 52(1/2):203-23.

  • -
  • Tarone RE, Ware J 1977 On Distribution-Free Tests for Equality of Survival Distributions. Biometrika;64(1):156-60.

  • -
  • Peto R, Peto J 1972 Asymptotically Efficient Rank Invariant Test Procedures. J Royal Statistical Society 135(2):186-207.

  • -
  • Fleming TR, Harrington DP, O’Sullivan M 1987 Supremum Versions of the Log-Rank and Generalized Wilcoxon Statistics. J American Statistical Association 82(397):312-20.

  • -
  • Billingsly P 1999 Convergence of Probability Measures. New York: John Wiley & Sons.

  • -
-
-
- - - -
- - - - -
- - - - - - diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-10-1.png deleted file mode 100644 index 9725406..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-10-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index 696b553..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index 696b553..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 0ba1d01..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index 06b6291..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-8-1.png deleted file mode 100644 index 2009be9..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-8-1.png and /dev/null differ diff --git a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-9-1.png deleted file mode 100644 index 4ee369f..0000000 Binary files a/docs/articles/Specifiying_weights_in_log-rank_comparisons_files/figure-html/unnamed-chunk-9-1.png and /dev/null differ diff --git a/docs/articles/ggforest-show-interactions-hazard-ratio.html b/docs/articles/ggforest-show-interactions-hazard-ratio.html deleted file mode 100644 index 065052f..0000000 --- a/docs/articles/ggforest-show-interactions-hazard-ratio.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - -ggforest: How to Show Interactions Hazard Ratio • survminer - - - - - - - - - - -
-
- - - - -
-
- - - - -
-

-Introduction

-

In general case it may be tricky to automatically extract interactions or variable transformations from model objects. A suggestion would be to create manually new variables that capture desired effects of interactions and add them to the model in an explicit way. This article describe an example of how to do this.

-
-
-

-Load required R packages

-
library(survminer)
-library(survival)
-
-
-

-Compute a Cox model with interaction terms

-
res.cox <- coxph(Surv(time, status) ~ ph.karno * age, data=lung)
-summary(res.cox, conf.int = FALSE)
-
Call:
-coxph(formula = Surv(time, status) ~ ph.karno * age, data = lung)
-
-  n= 227, number of events= 164 
-   (1 observation deleted due to missingness)
-
-                   coef  exp(coef)   se(coef)      z Pr(>|z|)  
-ph.karno     -0.1211782  0.8858761  0.0486092 -2.493   0.0127 *
-age          -0.1206758  0.8863212  0.0610426 -1.977   0.0481 *
-ph.karno:age  0.0016586  1.0016600  0.0007525  2.204   0.0275 *
----
-Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-
-Concordance= 0.598  (se = 0.025 )
-Likelihood ratio test= 14.52  on 3 df,   p=0.002
-Wald test            = 13.42  on 3 df,   p=0.004
-Score (logrank) test = 13.44  on 3 df,   p=0.004
-

Visualization of the hazard ratios using the function ggforest().

-
ggforest(res.cox, data = lung)
-

-

On the plot above, it can be seen that ggforest() ignores the interaction term ph.karno:age.

-

To fix this, a solution is to create manually the variable that handles the interaction:

-
lung$ph.karno_age <- lung$ph.karno * lung$age
-

and now you can fit an additive model and the ggforest() function will include it in the plot:

-
res.cox2 <- coxph(Surv(time, status) ~ ph.karno + age + ph.karno_age, data = lung)
-summary(res.cox2 , conf.int = FALSE)
-
Call:
-coxph(formula = Surv(time, status) ~ ph.karno + age + ph.karno_age, 
-    data = lung)
-
-  n= 227, number of events= 164 
-   (1 observation deleted due to missingness)
-
-                   coef  exp(coef)   se(coef)      z Pr(>|z|)  
-ph.karno     -0.1211782  0.8858761  0.0486092 -2.493   0.0127 *
-age          -0.1206758  0.8863212  0.0610426 -1.977   0.0481 *
-ph.karno_age  0.0016586  1.0016600  0.0007525  2.204   0.0275 *
----
-Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-
-Concordance= 0.598  (se = 0.025 )
-Likelihood ratio test= 14.52  on 3 df,   p=0.002
-Wald test            = 13.42  on 3 df,   p=0.004
-Score (logrank) test = 13.44  on 3 df,   p=0.004
-
ggforest(res.cox2, data=lung)
-

-
-
- - - -
- - - - -
- - - - - - diff --git a/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-1.png b/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-1.png deleted file mode 100644 index a897341..0000000 Binary files a/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-1.png and /dev/null differ diff --git a/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-with-interactions-1.png b/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-with-interactions-1.png deleted file mode 100644 index 5f8b1ad..0000000 Binary files a/docs/articles/ggforest-show-interactions-hazard-ratio_files/figure-html/ggforest-with-interactions-1.png and /dev/null differ diff --git a/docs/articles/ggsci.css b/docs/articles/ggsci.css deleted file mode 100644 index 3392b09..0000000 --- a/docs/articles/ggsci.css +++ /dev/null @@ -1,215 +0,0 @@ -body { - background-color: #fff; - margin: 1em auto; - max-width: 800px; - overflow: visible; - padding-left: 2em; - padding-right: 2em; - font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; - font-size: 16px; - line-height: 1.35; -} - -#header { - text-align: center; -} - -#TOC { - clear: both; - margin: 0 0 10px 0px; - padding: 15px; - width: 770px; - border: 1px solid #CCCCCC; - border-radius: 5px; - - background-color: #f6f6f6; - font-size: 16px; - line-height: 1.5; -} - #TOC .toctitle { - font-weight: bold; - font-size: 16px; - margin-left: 5px; - } - - #TOC ul { - padding-left: 50px; - margin-left: -1.5em; - margin-top: 5px; - margin-bottom: 5px; - } - #TOC ul ul { - margin-left: -2em; - } - #TOC li { - line-height: 20px; - } - -table { - margin: 1em auto; - border-width: 1px; - border-color: #DDDDDD; - border-style: outset; - border-collapse: collapse; -} -table th { - border-width: 2px; - padding: 5px; - border-style: inset; -} -table td { - border-width: 1px; - border-style: inset; - line-height: 18px; - padding: 5px 5px; -} -table, table th, table td { - border-left-style: none; - border-right-style: none; -} -table thead, table tr.even { - background-color: #f7f7f7; -} - -p { - margin: 0.5em 0; -} - -blockquote { - background-color: #f6f6f6; - padding: 0.25em 0.75em; -} - -hr { - border-style: solid; - border: none; - border-top: 1px solid #777; - margin: 28px 0; -} - -dl { - margin-left: 0; -} - dl dd { - margin-bottom: 13px; - margin-left: 13px; - } - dl dt { - font-weight: bold; - } - -ul { - margin-top: 0; -} - ul li { - list-style: circle outside; - } - ul ul { - margin-bottom: 0; - } - -pre, code { - background-color: #f7f7f7; - border-radius: 5px; - color: #333; - white-space: pre-wrap; /* Wrap long lines */ -} -pre { - border-radius: 5px; - margin: 5px 0px 10px 0px; - padding: 10px; -} -pre:not([class]) { - background-color: #f7f7f7; -} - -code { - font-family: "Lucida Console", Monaco, Consolas, 'Courier New', monospace; - font-size: 85%; -} -p > code, li > code { - padding: 2px 0px; -} - -div.figure { - text-align: center; -} -img { - background-color: #FFFFFF; - padding: 2px; - border: 1px solid #DDDDDD; - border-radius: 3px; - border: 1px solid #CCCCCC; - margin: 0 5px; -} - -h1 { - margin-top: 25px; - font-size: 35px; - line-height: 40px; -} - -h2 { - border-bottom: 2px solid #f7f7f7; - padding-top: 10px; - padding-bottom: 2px; - font-size: 145%; -} - -h3 { - border-bottom: 1px solid #f7f7f7; - padding-top: 10px; - font-size: 120%; -} - -h4 { - margin-left: 8px; - font-size: 105%; -} - -em { - font-style: normal; -} - -emph { - font-style: oblique; -} - -h5, h6 { - border-bottom: 1px solid #ccc; - font-size: 105%; -} - -a { - color: #123d79; - text-decoration: none; -} - a:hover { - color: #007CC3; } - a:visited { - color: #581858; } - a:visited:hover { - color: #007CC3; } - -/* code highlight theme: highlight.js - tomorrow - http://jmblog.github.io/color-themes-for-highlightjs/tomorrow/ -*/ - -code > span.kw { color: #4271ae; } /* Keyword */ -code > span.dt { color: #c82829; } /* DataType */ -code > span.dv { color: #f5871f; } /* DecVal (decimal values) */ -code > span.bn { color: #718c00; } /* BaseN */ -code > span.fl { color: #718c00; } /* Float */ -code > span.ch { color: #718c00; } /* Char */ -code > span.st { color: #718c00; } /* String */ -code > span.co { color: #8e908c; } /* Comment */ -code > span.ot { color: #4d4d4c; } /* OtherToken */ -code > span.al { color: #ff0000; } /* AlertToken */ -code > span.fu { color: #4271ae; } /* Function calls */ -code > span.er { color: #a61717; } /* ErrorTok */ - -/* centering images */ -img { - display: block; - margin: 0 auto; -} diff --git a/docs/articles/index.html b/docs/articles/index.html deleted file mode 100644 index c03a670..0000000 --- a/docs/articles/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - -Articles • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- -
- - - -
- - - - - - - - diff --git a/docs/articles/survminer_orly.png b/docs/articles/survminer_orly.png deleted file mode 100644 index f917f9a..0000000 Binary files a/docs/articles/survminer_orly.png and /dev/null differ diff --git a/docs/authors.html b/docs/authors.html deleted file mode 100644 index 86455dd..0000000 --- a/docs/authors.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - -Authors • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
-
- - -
    -
  • -

    Alboukadel Kassambara. Author, maintainer. -

    -
  • -
  • -

    Marcin Kosinski. Author. -

    -
  • -
  • -

    Przemyslaw Biecek. Author. -

    -
  • -
  • -

    Scheipl Fabian. Contributor. -

    -
  • -
- -
- -
- - - - -
- - - - - - - - diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css deleted file mode 100644 index 5a85941..0000000 --- a/docs/bootstrap-toc.css +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ - -/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ - -/* All levels of nav */ -nav[data-toggle='toc'] .nav > li > a { - display: block; - padding: 4px 20px; - font-size: 13px; - font-weight: 500; - color: #767676; -} -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 19px; - color: #563d7c; - text-decoration: none; - background-color: transparent; - border-left: 1px solid #563d7c; -} -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 18px; - font-weight: bold; - color: #563d7c; - background-color: transparent; - border-left: 2px solid #563d7c; -} - -/* Nav: second level (shown on .active) */ -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} -nav[data-toggle='toc'] .nav .nav > li > a { - padding-top: 1px; - padding-bottom: 1px; - padding-left: 30px; - font-size: 12px; - font-weight: normal; -} -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 29px; -} -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 28px; - font-weight: 500; -} - -/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ -nav[data-toggle='toc'] .nav > .active > ul { - display: block; -} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js deleted file mode 100644 index 1cdd573..0000000 --- a/docs/bootstrap-toc.js +++ /dev/null @@ -1,159 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ -(function() { - 'use strict'; - - window.Toc = { - helpers: { - // return all matching elements in the set, or their descendants - findOrFilter: function($el, selector) { - // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ - // http://stackoverflow.com/a/12731439/358804 - var $descendants = $el.find(selector); - return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); - }, - - generateUniqueIdBase: function(el) { - var text = $(el).text(); - var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); - return anchor || el.tagName.toLowerCase(); - }, - - generateUniqueId: function(el) { - var anchorBase = this.generateUniqueIdBase(el); - for (var i = 0; ; i++) { - var anchor = anchorBase; - if (i > 0) { - // add suffix - anchor += '-' + i; - } - // check if ID already exists - if (!document.getElementById(anchor)) { - return anchor; - } - } - }, - - generateAnchor: function(el) { - if (el.id) { - return el.id; - } else { - var anchor = this.generateUniqueId(el); - el.id = anchor; - return anchor; - } - }, - - createNavList: function() { - return $(''); - }, - - createChildNavList: function($parent) { - var $childList = this.createNavList(); - $parent.append($childList); - return $childList; - }, - - generateNavEl: function(anchor, text) { - var $a = $(''); - $a.attr('href', '#' + anchor); - $a.text(text); - var $li = $('
  • '); - $li.append($a); - return $li; - }, - - generateNavItem: function(headingEl) { - var anchor = this.generateAnchor(headingEl); - var $heading = $(headingEl); - var text = $heading.data('toc-text') || $heading.text(); - return this.generateNavEl(anchor, text); - }, - - // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). - getTopLevel: function($scope) { - for (var i = 1; i <= 6; i++) { - var $headings = this.findOrFilter($scope, 'h' + i); - if ($headings.length > 1) { - return i; - } - } - - return 1; - }, - - // returns the elements for the top level, and the next below it - getHeadings: function($scope, topLevel) { - var topSelector = 'h' + topLevel; - - var secondaryLevel = topLevel + 1; - var secondarySelector = 'h' + secondaryLevel; - - return this.findOrFilter($scope, topSelector + ',' + secondarySelector); - }, - - getNavLevel: function(el) { - return parseInt(el.tagName.charAt(1), 10); - }, - - populateNav: function($topContext, topLevel, $headings) { - var $context = $topContext; - var $prevNav; - - var helpers = this; - $headings.each(function(i, el) { - var $newNav = helpers.generateNavItem(el); - var navLevel = helpers.getNavLevel(el); - - // determine the proper $context - if (navLevel === topLevel) { - // use top level - $context = $topContext; - } else if ($prevNav && $context === $topContext) { - // create a new level of the tree and switch to it - $context = helpers.createChildNavList($prevNav); - } // else use the current $context - - $context.append($newNav); - - $prevNav = $newNav; - }); - }, - - parseOps: function(arg) { - var opts; - if (arg.jquery) { - opts = { - $nav: arg - }; - } else { - opts = arg; - } - opts.$scope = opts.$scope || $(document.body); - return opts; - } - }, - - // accepts a jQuery object, or an options object - init: function(opts) { - opts = this.helpers.parseOps(opts); - - // ensure that the data attribute is in place for styling - opts.$nav.attr('data-toggle', 'toc'); - - var $topContext = this.helpers.createChildNavList(opts.$nav); - var topLevel = this.helpers.getTopLevel(opts.$scope); - var $headings = this.helpers.getHeadings(opts.$scope, topLevel); - this.helpers.populateNav($topContext, topLevel, $headings); - } - }; - - $(function() { - $('nav[data-toggle="toc"]').each(function(i, el) { - var $nav = $(el); - Toc.init($nav); - }); - }); -})(); diff --git a/docs/docsearch.css b/docs/docsearch.css deleted file mode 100644 index e5f1fe1..0000000 --- a/docs/docsearch.css +++ /dev/null @@ -1,148 +0,0 @@ -/* Docsearch -------------------------------------------------------------- */ -/* - Source: https://github.com/algolia/docsearch/ - License: MIT -*/ - -.algolia-autocomplete { - display: block; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1 -} - -.algolia-autocomplete .ds-dropdown-menu { - width: 100%; - min-width: none; - max-width: none; - padding: .75rem 0; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, .1); - box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); -} - -@media (min-width:768px) { - .algolia-autocomplete .ds-dropdown-menu { - width: 175% - } -} - -.algolia-autocomplete .ds-dropdown-menu::before { - display: none -} - -.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { - padding: 0; - background-color: rgb(255,255,255); - border: 0; - max-height: 80vh; -} - -.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { - margin-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion { - padding: 0; - overflow: visible -} - -.algolia-autocomplete .algolia-docsearch-suggestion--category-header { - padding: .125rem 1rem; - margin-top: 0; - font-size: 1.3em; - font-weight: 500; - color: #00008B; - border-bottom: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { - float: none; - padding-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { - float: none; - width: auto; - padding: 0; - text-align: left -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content { - float: none; - width: auto; - padding: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content::before { - display: none -} - -.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { - padding-top: .75rem; - margin-top: .75rem; - border-top: 1px solid rgba(0, 0, 0, .1) -} - -.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { - display: block; - padding: .1rem 1rem; - margin-bottom: 0.1; - font-size: 1.0em; - font-weight: 400 - /* display: none */ -} - -.algolia-autocomplete .algolia-docsearch-suggestion--title { - display: block; - padding: .25rem 1rem; - margin-bottom: 0; - font-size: 0.9em; - font-weight: 400 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--text { - padding: 0 1rem .5rem; - margin-top: -.25rem; - font-size: 0.8em; - font-weight: 400; - line-height: 1.25 -} - -.algolia-autocomplete .algolia-docsearch-footer { - width: 110px; - height: 20px; - z-index: 3; - margin-top: 10.66667px; - float: right; - font-size: 0; - line-height: 0; -} - -.algolia-autocomplete .algolia-docsearch-footer--logo { - background-image: url("data:image/svg+xml;utf8,"); - background-repeat: no-repeat; - background-position: 50%; - background-size: 100%; - overflow: hidden; - text-indent: -9000px; - width: 100%; - height: 100%; - display: block; - transform: translate(-8px); -} - -.algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #FF8C00; - background: rgba(232, 189, 54, 0.1) -} - - -.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { - box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) -} - -.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { - background-color: rgba(192, 192, 192, .15) -} diff --git a/docs/docsearch.js b/docs/docsearch.js deleted file mode 100644 index b35504c..0000000 --- a/docs/docsearch.js +++ /dev/null @@ -1,85 +0,0 @@ -$(function() { - - // register a handler to move the focus to the search bar - // upon pressing shift + "/" (i.e. "?") - $(document).on('keydown', function(e) { - if (e.shiftKey && e.keyCode == 191) { - e.preventDefault(); - $("#search-input").focus(); - } - }); - - $(document).ready(function() { - // do keyword highlighting - /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ - var mark = function() { - - var referrer = document.URL ; - var paramKey = "q" ; - - if (referrer.indexOf("?") !== -1) { - var qs = referrer.substr(referrer.indexOf('?') + 1); - var qs_noanchor = qs.split('#')[0]; - var qsa = qs_noanchor.split('&'); - var keyword = ""; - - for (var i = 0; i < qsa.length; i++) { - var currentParam = qsa[i].split('='); - - if (currentParam.length !== 2) { - continue; - } - - if (currentParam[0] == paramKey) { - keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); - } - } - - if (keyword !== "") { - $(".contents").unmark({ - done: function() { - $(".contents").mark(keyword); - } - }); - } - } - }; - - mark(); - }); -}); - -/* Search term highlighting ------------------------------*/ - -function matchedWords(hit) { - var words = []; - - var hierarchy = hit._highlightResult.hierarchy; - // loop to fetch from lvl0, lvl1, etc. - for (var idx in hierarchy) { - words = words.concat(hierarchy[idx].matchedWords); - } - - var content = hit._highlightResult.content; - if (content) { - words = words.concat(content.matchedWords); - } - - // return unique words - var words_uniq = [...new Set(words)]; - return words_uniq; -} - -function updateHitURL(hit) { - - var words = matchedWords(hit); - var url = ""; - - if (hit.anchor) { - url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; - } else { - url = hit.url + '?q=' + escape(words.join(" ")); - } - - return url; -} diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 88e359c..0000000 --- a/docs/index.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - -Drawing Survival Curves using ggplot2 • survminer - - - - - - - - - - -
    -
    - - - - -
    -
    - - -


    - -
    - -

    The survminer R package provides functions for facilitating survival analysis and visualization.

    -

    The main functions, in the package, are organized in different categories as follow.

    -Survival Curves -
    -


    -
      -
    • ggsurvplot(): Draws survival curves with the ‘number at risk’ table, the cumulative number of events table and the cumulative number of censored subjects table.

    • -
    • arrange_ggsurvplots(): Arranges multiple ggsurvplots on the same page.

    • -
    • ggsurvevents(): Plots the distribution of event’s times.

    • -
    • surv_summary(): Summary of a survival curve. Compared to the default summary() function, surv_summary() creates a data frame containing a nice summary from survfit results.

    • -
    • surv_cutpoint(): Determines the optimal cutpoint for one or multiple continuous variables at once. Provides a value of a cutpoint that correspond to the most significant relation with survival.

    • -
    • pairwise_survdiff(): Multiple comparisons of survival curves. Calculate pairwise comparisons between group levels with corrections for multiple testing.

    • -
    -


    -Diagnostics of Cox Model -
    -


    -
      -
    • ggcoxzph(): Graphical test of proportional hazards. Displays a graph of the scaled Schoenfeld residuals, along with a smooth curve using ggplot2. Wrapper around plot.cox.zph().

    • -
    • ggcoxdiagnostics(): Displays diagnostics graphs presenting goodness of Cox Proportional Hazards Model fit.

    • -
    • ggcoxfunctional(): Displays graphs of continuous explanatory variable against martingale residuals of null cox proportional hazards model. It helps to properly choose the functional form of continuous variable in cox model.

    • -
    -


    -Summary of Cox Model -
    -


    -
      -
    • ggforest(): Draws forest plot for CoxPH model.

    • -
    • ggcoxadjustedcurves(): Plots adjusted survival curves for coxph model.

    • -
    -


    -Competing Risks -
    -


    -
      -
    • -ggcompetingrisks(): Plots cumulative incidence curves for competing risks.
    • -
    -


    -
    -

    Find out more at https://rpkgs.datanovia.com/survminer/, and check out the documentation and usage examples of each of the functions in survminer package.

    -
    -
    -

    -Installation and loading

    -

    Install from CRAN as follow:

    -
    install.packages("survminer")
    -

    Or, install the latest version from GitHub:

    -
    if(!require(devtools)) install.packages("devtools")
    -devtools::install_github("kassambara/survminer", build_vignettes = FALSE)
    -

    Load survminer:

    -
    library("survminer")
    -
    -
    -

    -ggsurvplot: Drawing survival curves

    -
    -

    -Fitting survival curves

    -
    require("survival")
    -fit <- survfit(Surv(time, status) ~ sex, data = lung)
    -
    -
    -

    -Basic plots

    -
    ggsurvplot(fit, data = lung)
    -

    -

    Censor shape can be changed as follow:

    -
    ggsurvplot(fit, data = lung, censor.shape="|", censor.size = 4)
    -
    -
    -

    -Customized survival curves

    -
    ggsurvplot(
    -  fit,
    -  data = lung,
    -  size = 1,                 # change line size
    -  palette =
    -    c("#E7B800", "#2E9FDF"),# custom color palettes
    -  conf.int = TRUE,          # Add confidence interval
    -  pval = TRUE,              # Add p-value
    -  risk.table = TRUE,        # Add risk table
    -  risk.table.col = "strata",# Risk table color by groups
    -  legend.labs =
    -    c("Male", "Female"),    # Change legend labels
    -  risk.table.height = 0.25, # Useful to change when you have multiple groups
    -  ggtheme = theme_bw()      # Change ggplot2 theme
    -)
    -

    -

    Note that, additional arguments are available to customize the main title, axis labels, the font style, axis limits, legends and the number at risk table.

    -
    -
    -

    -More customized survival curves

    -

    Focus on xlim and break.time.by parameters which do not change the calculations of estimates of survival surves. Also note risk.table.y.text.col = TRUE and risk.table.y.text = FALSE that provide bars instead of names in text annotations of the legend of risk table.

    -
    ggsurvplot(
    -   fit,                     # survfit object with calculated statistics.
    -   data = lung,             # data used to fit survival curves.
    -   risk.table = TRUE,       # show risk table.
    -   pval = TRUE,             # show p-value of log-rank test.
    -   conf.int = TRUE,         # show confidence intervals for 
    -                            # point estimates of survival curves.
    -   xlim = c(0,500),         # present narrower X axis, but not affect
    -                            # survival estimates.
    -   xlab = "Time in days",   # customize X axis label.
    -   break.time.by = 100,     # break X axis in time intervals by 500.
    -   ggtheme = theme_light(), # customize plot and risk table with a theme.
    - risk.table.y.text.col = T, # colour risk table text annotations.
    -  risk.table.y.text = FALSE # show bars instead of names in text annotations
    -                            # in legend of risk table
    -)
    -

    -
    -
    -

    -Uber customized survival curves

    -
    ggsurv <- ggsurvplot(
    -           fit,                     # survfit object with calculated statistics.
    -           data = lung,             # data used to fit survival curves.
    -           risk.table = TRUE,       # show risk table.
    -           pval = TRUE,             # show p-value of log-rank test.
    -           conf.int = TRUE,         # show confidence intervals for 
    -                                    # point estimates of survival curves.
    -           palette = c("#E7B800", "#2E9FDF"),
    -           xlim = c(0,500),         # present narrower X axis, but not affect
    -                                    # survival estimates.
    -           xlab = "Time in days",   # customize X axis label.
    -           break.time.by = 100,     # break X axis in time intervals by 500.
    -           ggtheme = theme_light(), # customize plot and risk table with a theme.
    -          risk.table.y.text.col = T,# colour risk table text annotations.
    -          risk.table.height = 0.25, # the height of the risk table
    -          risk.table.y.text = FALSE,# show bars instead of names in text annotations
    -                                    # in legend of risk table.
    -          ncensor.plot = TRUE,      # plot the number of censored subjects at time t
    -          ncensor.plot.height = 0.25,
    -          conf.int.style = "step",  # customize style of confidence intervals
    -          surv.median.line = "hv",  # add the median survival pointer.
    -          legend.labs =
    -            c("Male", "Female")    # change legend labels.
    -        )
    -ggsurv
    -

    -
    -
    -

    -Uber platinum customized survival curves

    -

    Helper function to customize plot labels:

    -
    customize_labels <- function (p, font.title = NULL,
    -                              font.subtitle = NULL, font.caption = NULL,
    -                              font.x = NULL, font.y = NULL, font.xtickslab = NULL, font.ytickslab = NULL)
    -{
    -  original.p <- p
    -  if(is.ggplot(original.p)) list.plots <- list(original.p)
    -  else if(is.list(original.p)) list.plots <- original.p
    -  else stop("Can't handle an object of class ", class (original.p))
    -  .set_font <- function(font){
    -    font <- ggpubr:::.parse_font(font)
    -    ggtext::element_markdown (size = font$size, face = font$face, colour = font$color)
    -  }
    -  for(i in 1:length(list.plots)){
    -    p <- list.plots[[i]]
    -    if(is.ggplot(p)){
    -      if (!is.null(font.title)) p <- p + theme(plot.title = .set_font(font.title))
    -      if (!is.null(font.subtitle)) p <- p + theme(plot.subtitle = .set_font(font.subtitle))
    -      if (!is.null(font.caption)) p <- p + theme(plot.caption = .set_font(font.caption))
    -      if (!is.null(font.x)) p <- p + theme(axis.title.x = .set_font(font.x))
    -      if (!is.null(font.y)) p <- p + theme(axis.title.y = .set_font(font.y))
    -      if (!is.null(font.xtickslab)) p <- p + theme(axis.text.x = .set_font(font.xtickslab))
    -      if (!is.null(font.ytickslab)) p <- p + theme(axis.text.y = .set_font(font.ytickslab))
    -      list.plots[[i]] <- p
    -    }
    -  }
    -  if(is.ggplot(original.p)) list.plots[[1]]
    -  else list.plots
    -}
    -

    Customized plot labels:

    -
    # Changing Labels
    -# %%%%%%%%%%%%%%%%%%%%%%%%%%
    -# Labels for Survival Curves (plot)
    -ggsurv$plot <- ggsurv$plot + labs(
    -  title    = "Survival curves",
    -  subtitle = "Based on Kaplan-Meier estimates",
    -  caption  = "created with survminer"
    -  )
    -
    -# Labels for Risk Table 
    -ggsurv$table <- ggsurv$table + labs(
    -  title    = "Note the risk set sizes",
    -  subtitle = "and remember about censoring.",
    -  caption  = "source code: website.com"
    -  )
    -
    -# Labels for ncensor plot 
    -ggsurv$ncensor.plot <- ggsurv$ncensor.plot + labs(
    -  title    = "Number of censorings",
    -  subtitle = "over the time.",
    -  caption  = "source code: website.com"
    -  )
    -
    -# Changing the font size, style and color
    -# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    -# Applying the same font style to all the components of ggsurv:
    -# survival curves, risk table and censor part
    -
    -ggsurv <- customize_labels(
    -  ggsurv,
    -  font.title    = c(16, "bold", "darkblue"),
    -  font.subtitle = c(15, "bold.italic", "purple"),
    -  font.caption  = c(14, "plain", "orange"),
    -  font.x        = c(14, "bold.italic", "red"),
    -  font.y        = c(14, "bold.italic", "darkred"),
    -  font.xtickslab = c(12, "plain", "darkgreen")
    -)
    -
    -ggsurv
    -

    -
    -
    -
    -

    -Uber platinum premium customized survival curves

    -
    # Using specific fonts for risk table and ncensor plots
    -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    -# Font for Risk Table
    -ggsurv$table <- customize_labels(
    -  ggsurv$table,
    -  font.title    = c(13, "bold.italic", "green"),
    -  font.subtitle = c(15, "bold", "pink"),
    -  font.caption  = c(11, "plain", "darkgreen"),
    -  font.x        = c(8, "bold.italic", "orange"),
    -  font.y        = c(11, "bold.italic", "darkgreen"),
    -  font.xtickslab = c(9, "bold", "red")
    -)
    -
    -
    -# Font for ncensor plot
    -ggsurv$ncensor.plot <- customize_labels(
    -  ggsurv$ncensor.plot,
    -  font.title    = c(13, "bold.italic", "green"),
    -  font.subtitle = c(15, "bold", "pink"),
    -  font.caption  = c(11, "plain", "darkgreen"),
    -  font.x        = c(8, "bold.italic", "orange"),
    -  font.y        = c(11, "bold.italic", "darkgreen"),
    -  font.xtickslab = c(9, "bold", "red")
    -)
    -
    -print(ggsurv)
    -

    -
    -
    -

    -Blog posts

    - -
    -
    - -
    - - -
    - - -
    - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - diff --git a/docs/link.svg b/docs/link.svg deleted file mode 100644 index 88ad827..0000000 --- a/docs/link.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/docs/news/index.html b/docs/news/index.html deleted file mode 100644 index 994555b..0000000 --- a/docs/news/index.html +++ /dev/null @@ -1,845 +0,0 @@ - - - - - - - - -Changelog • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    -Survminer 0.4.9 Unreleased -

    -
    -

    -Minor changes

    -
      -
    • A new vignette added to show how to display interaction using ggforest() (#496).
    • -
    • Since ggplot2 v3.3.0, the function element_text() issues a warning when vectorized arguments are provided, as in colour = c(“red”, “green”, “blue”). This is a breaking change affecting the function ggsurvtable(). To fix this, the function ggtext::element_markdown() is now used in place of element_text() to handle vectorized colors (issue #455 fixed by pull #503).
    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -survminer 0.4.8 2020-07-25 -

    -
    -

    -Minor changes

    -
      -
    • Maintenance update due to new broom 0.7.0 version by explicitly setting conf.int = TRUE in the call to tidy.coxph from ggforest() (pull 485).
    • -
    -
    -
    -
    -

    -Survminer 0.4.7 2020-05-28 -

    -
    -

    -Minor changes

    -
      -
    • In older versions of the survival package, the function survfit(res.cox) returned an object of class survfit.cox. The class has been changed to survfitcox in the current survival package version. The survminer package has been now updated to take this change into account (@edvbb, #441).
    • -
    -

    Fixes to adapt to dplyr 1.0.0 (@romainfrancois, #460):

    -
      -
    • Using group_by() instead of group_by_() which is deprecated
    • -
    • Putting the extra “surv_group_by” class first where it is supposed to be instead of last, which messes up with some internal processing from vctrs.
    • -
    -
    -
    -

    -Bug fxes

    -
      -
    • When the group size is small (i.e. n = 1), NAs are introduced during the computation of the confidence interval leading to a failure when specifying the option conf.int in the ggsurvplot() function. To fix this issue, Now, NAs are removed by default when drawing the confidence interval (#443 and #315).
    • -
    -
    -
    -
    -

    -Survminer 0.4.6 2019-09-03 -

    -
    -

    -New features

    -
      -
    • A new function surv_adjustedcurves is extracted from ggadjustedcurves. This function calculates adjusted survival curves but do not plot them. Its results may be useful for calculation of median survival or some other statistics. (@pbiecek, #423).
    • -
    -
    -
    -

    -Minor changes

    -
      -
    • Adapted to tidyr 1.0.0 (#424)
    • -
    -
    -
    -
    -

    -Survminer 0.4.5 2019-08-03 -

    -
    -

    -Minor changes

    -
      -
    • Adding variable with a group-agnostic approach (@jennybc, #414 -
    • -
    • -cmprsk is no longer needed for survminer installation. The package has been moved from Imports to Suggests. It’s only used in documentations (@massimofagg, #394.
    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -Survminer 0.4.4 2019-05-21 -

    -
    -

    -Minor changes

    - -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -Survminer 0.4.3 2018-08-04 -

    -
    -

    -New features

    - -
    -
    -

    -Minor changes

    - -
    -
    -

    -Bug fixes

    -
      -
    • Now, hiding strata names in risk table work when combining survfits (@krassowski, #317).
    • -
    • Now, axes.offset argument is also applied to risk table (@dmartinffm, #243).
    • -
    • It is now possible to add ggsurvplot to powerpoint document using ReporteRs even if there is no risk table (@DrRZ, #314).
    • -
    -
    -
    -
    -

    -Survminer 0.4.2 2018-01-31 -

    -
    -

    -Minor changes

    - -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -survminer 0.4.1 2017-11-17 -

    -
    -

    -New features

    -
      -
    • New function ggflexsurvplot() to create ggplot2-based graphs for flexible survival models.

    • -
    • The function ggadjustedcurves() handles now argument method that defines how adjusted curves shall be calculated. With method='conditional'|'marginal' subpopulations are balanced with respect to variables present in the model formula. With method='single'|'average' the curve represents just the expected survival curves.

    • -
    -
    -
    -

    -Major changes

    - -
    -
    -

    -Minor changes

    -
      -
    • The grouping variable to the ggadjustedcurves() function is now passed as a name (character) of grouping variable not as a vector with values of grouping variable.

    • -
    • New argument font.family in ggsurvtable() to change the font family in the survival tables - such as risk, cummulative events and censoring tables. For example font.family = “Courier New” (@Swechhya, #245).

    • -
    • Now, in ggsurvplot() the data argument should be strictly provided (@dnzmarcio, #235)

    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -survminer 0.4.0 2017-06-07 -

    -
    -

    -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

    - -
    -
    -
    -

    -survminer 0.3.1 2017-03-21 -

    -
    -

    -Minor changes

    -
      -
    • The example section of the ggcoxdiagnostics() function and the vignette file Informative_Survival_Plots.Rmd have been updated so that survminer can pass CRAN check under R-oldrelease.
    • -
    • New example dataset BMT added for competing risk analysis.
    • -
    • New data set BRCAOV.survInfo added, used in vignette files
    • -
    -
    -
    -

    -Bug fixes

    -
      -
    • Now, palette argument works in `ggcoxadjustedcurves() (#174)
    • -
    • Now ggsurvplot() works when the fun argument is an arbitrary function (#176).
    • -
    -
    -
    -
    -

    -survminer 0.3.0 2017-03-16 -

    -
    -

    -New features

    -
    -

    -New options in ggsurvplot()

    -
      -
    • Additional data argument added to the ggsurvplot() function (@kassambara, #142). Now, it’s recommended to pass to the function, the data used to fit survival curves. This will avoid the error generated when trying to use the ggsurvplot() function inside another functions (@zzawadz, #125).

    • -
    • New argument risk.table.pos, for placing risk table inside survival curves (#69). Allowed options are one of c(“out”, “in”) indicating ‘outside’ or ‘inside’ the main plot, respectively. Default value is “out”.

    • -
    • New arguments tables.height, tables.y.text, tables.theme, tables.col: for customizing tables under the main survival plot: (#156).

    • -
    • New arguments cumevents and cumcensor: logical value for displaying the cumulative number of events table (#117) and the cumulative number of censored subject (#155), respectively.

    • -
    • Now, ggsurvplot() can display both the number at risk and the cumulative number of censored in the same table using the option risk.table = 'nrisk_cumcenor' (#96). It’s also possible to display the number at risk and the cumulative number of events using the option risk.table = 'nrisk_cumevents'.

    • -
    • New arguments pval.method and log.rank.weights: New possibilities to compare survival curves. Functionality based on survMisc::comp.

    • -
    • New arguments break.x.by and break.y.by, numeric value controlling x and y axis breaks, respectively.

    • -
    • -

      Now, ggsurvplot() returns an object of class ggsurvplot which is list containing the following components (#158):

      -
        -
      • -plot: the survival plot (ggplot object)
      • -
      • -table: the number of subjects at risk table per time (ggplot object). Returned only when risk.table = TRUE.
      • -
      • -cumevents: the cumulative number of events table (ggplot object). Returned only when cumevents = TRUE.
      • -
      • -ncensor.plot: the number of censoring (ggplot object). Returned only when ncensor.plot = TRUE or cumcensor = TRUE.
      • -
      • -data.survplot: the data used to plot the survival curves (data.frame).
      • -
      • -data.survtable: the data used to plot the tables under the main survival curves (data.frame).
      • -
      -
    • -
    -
    -
    -

    -Themes

    -
      -
    • New function theme_survminer() to change easily the graphical parameters of plots generated with survminer (#151). A theme similar to theme_classic() with large font size. Used as default theme in survminer functions.

    • -
    • New function theme_cleantable() to draw a clean risk table and cumulative number of events table. Remove axis lines, x axis ticks and title (#117 & #156).

    • -
    -
    # Fit survival curves
    -require("survival")
    -fit<- survfit(Surv(time, status) ~ sex, data = lung)
    -
    -# Survival curves
    -require("survminer")
    -ggsurvplot(fit, data = lung, risk.table = TRUE,
    -    tables.theme = theme_cleantable()
    -    )
    -
    -
    -

    -New functions

    -
      -
    • New function +.ggsurv() to add ggplot components - theme(), labs() - to an object of class ggsurv, which is a list of ggplots. (#151). For example:
    • -
    -
    # Fit survival curves
    -require("survival")
    -fit<- survfit(Surv(time, status) ~ sex, data = lung)
    -
    -# Basic survival curves
    -require("survminer")
    -p <- ggsurvplot(fit, data = lung, risk.table = TRUE)
    -p
    -
    -# Customizing the plots
    -p %+% theme_survminer(
    -     font.main = c(16, "bold", "darkblue"),
    -     font.submain = c(15, "bold.italic", "purple"),
    -     font.caption = c(14, "plain", "orange"),
    -     font.x = c(14, "bold.italic", "red"),
    -     font.y = c(14, "bold.italic", "darkred"),
    -     font.tickslab = c(12, "plain", "darkgreen")
    -)
    -
      -
    • New function arrange_ggsurvplots() to arrange multiple ggsurvplots on the same page (#66).

    • -
    • New function ggsurvevents() to calculate and plot the distribution for events (both status = 0 and status = 1); with type parameter one can plot cumulative distribution of locally smooth density; with normalised, distributions are normalised. This function helps to notice when censorings are more common (@pbiecek, #116).

    • -
    • New function ggcoxadjustedcurves() to plot adjusted survival curves for Cox proportional hazards model (@pbiecek, #133 & @markdanese, #67).

    • -
    • New function ggforest() for drawing forest plot for the Cox model.

    • -
    • New function pairwise_survdiff() for multiple comparisons of survival Curves (#97).

    • -
    • New function ggcompetingrisks() to plot the cumulative incidence curves for competing risks (@pbiecek, #168.

    • -
    -
    -
    -

    -Helper functions

    -

    New heper functions ggrisktable(), ggcumevents(), ggcumcensor(). Normally, users don’t need to use these function directly. Internally used by the function ggsurvplot().

    - -
    -
    -
    -

    -Major changes

    -
      -
    • New argument sline in the ggcoxdiagnostics() function for adding loess smoothed trend on the residual plots. This will make it easier to spot some problems with residuals (like quadratic relation). (@pbiecek, #119).

    • -
    • The design of ggcoxfunctional() has been changed to be consistent with the other functions in the survminer package. Now, ggcoxfunctional() works with coxph objects not formulas. The arguments formula is now deprecated (@pbiecek, #115).

    • -
    • In the ggcoxdiagnostics() function, it’s now possible to plot Time in the OX axis (@pbiecek, #124). This is convenient for some residuals like Schoenfeld. The linear.predictions parameter has been replaced with ox.scale = c("linear.predictions", "time", "observation.id").

    • -
    -
    -
    -

    -Minor changes

    -
      -
    • New argument tables.height in ggsurvplot() to apply the same height to all the tables under the main survival plots (#157).

    • -
    • It is possible to specify title and caption for ggcoxfunctional (@MarcinKosinski, #138) (font.main was removed as it was unused.)

    • -
    • It is possible to specify title, subtitle and caption for ggcoxdiagnostics (@MarcinKosinski, #139) and fonts for them.

    • -
    • It is possible to specify global caption for ggcoxzph (@MarcinKosinski, #140).

    • -
    • In ggsurvplot(), more information, about color palettes, have been added in the details section of the documentation (#100).

    • -
    • The R package maxstat doesn’t support very well an object of class tbl_df. To fix this issue, now, in the surv_cutpoint() function, the input data is systematically transformed into a standard data.frame format (@MarcinKosinski, #104).

    • -
    • It’s now possible to print the output of the survminer packages in a powerpoint created with the ReporteRs package. You should use the argument newpage = FALSE in the print() function when printing the output in the powerpoint. Thanks to (@abossenbroek, #110) and (@zzawadz, #111). For instance:

    • -
    -
    require(survival)
    -require(ReporteRs)
    -require(survminer)
    -
    -fit <- survfit(Surv(time, status) ~ rx + adhere, data =colon)
    -survplot <- ggsurvplot(fit, pval = TRUE,
    -                       break.time.by = 400,
    -                       risk.table = TRUE,
    -                       risk.table.col = "strata",
    -                       risk.table.height = 0.5, # Useful when you have multiple groups
    -                       palette = "Dark2")
    -
    -
    -require(ReporteRs)
    -doc = pptx(title = "Survival plots")
    -doc = addSlide(doc, slide.layout = "Title and Content")
    -doc = addTitle(doc, "First try")
    -doc = addPlot(doc, function() print(survplot, newpage = FALSE), vector.graphic = TRUE)
    -writeDoc(doc, "test.pptx")
    -
      -
    • Now, in ggcoxdiagnostics(), the option ncol = 1 is removed from the function facet_wrap(). By default, ncol = NULL. In this case, the number of columns and rows in the plot panels is defined automatically based on the number of covariates included in the cox model.
    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -

    -Vignettes and examples

    -
      -
    • A new vignette and a ggsurvplot example was added to present new functionalities of possible texts and fonts customizations.

    • -
    • A new vignette and a ggsurvplot example was added to present new functionalities of possible weights specification in a Log-rank test.

    • -
    -
    -
    -
    -

    -survminer 0.2.4 2016-12-11 -

    -
    -

    -Bug fixes

    -
      -
    • surv_summary() (v0.2.3) generated an error when the name of the variable used in survfit() can be found multiple times in the levels of the same variable. For example, variable = therapy; levels(therapy) –> “therapy” and “hormone therapy” (#86). This has been now fixed.

    • -
    • To extract variable names used in survival::survfit(), the R code strsplit(strata, "=|,\\s+", perl=TRUE) was used in the surv_summary() function [survminer v0.2.3]. The splitting was done at any “=” symbol in the string, causing an error when special characters (=, <=, >=) are used for the levels of a categorical variable (#91). This has been now fixed.

    • -
    • Now, ggsurvplot() draws correctly the risk.table (#93).

    • -
    -
    -
    -
    -

    -survminer 0.2.3 2016-12-07 -

    -
    -

    -New features

    -
      -
    • New function surv_summary() for creating data frame containing a nice summary of a survival curve (#64).
    • -
    • It’s possible now to facet the output of ggsurvplot() by one or more factors (#64):
    • -
    -
    # Fit complexe survival curves
    -require("survival")
    -fit3 <- survfit( Surv(time, status) ~ sex + rx + adhere,
    -                data = colon )
    -                
    -# Visualize by faceting
    -# Plots are survival curves by sex faceted by rx and adhere factors.
    -require("survminer")  
    -ggsurv$plot +theme_bw() + facet_grid(rx ~ adhere)
    -
      -
    • Now, ggsurvplot() can be used to plot cox model (#67).
    • -
    • New ‘myeloma’ data sets added.
    • -
    • New functions added for determining and visualizing the optimal cutpoint of continuous variables for survival analyses: -
        -
      • -surv_cutpoint(): Determine the optimal cutpoint for each variable using ‘maxstat’. Methods defined for surv_cutpoint object are summary(), print() and plot().
      • -
      • -surv_categorize(): Divide each variable values based on the cutpoint returned by surv_cutpoint() (#41).
      • -
      -
    • -
    • New argument ‘ncensor.plot’ added to ggsurvplot(). A logical value. If TRUE, the number of censored subjects at time t is plotted. Default is FALSE (#18).
    • -
    -
    -
    -

    -Minor changes

    -
      -
    • New argument ‘conf.int.style’ added in ggsurvplot() for changing the style of confidence interval bands.
    • -
    • Now, ggsurvplot() plots a stepped confidence interval when conf.int = TRUE (#65).
    • -
    • -ggsurvplot() updated for compatibility with the future version of ggplot2 (v2.2.0) (#68)
    • -
    • ylab is now automatically adapted according to the value of the argument fun. For example, if fun = “event”, then ylab will be “Cumulative event”.
    • -
    • In ggsurvplot(), linetypes can now be adjusted by variables used to fit survival curves (#46)
    • -
    • In ggsurvplot(), the argument risk.table can be either a logical value (TRUE|FALSE) or a string (“absolute”, “percentage”). If risk.table = “absolute”, ggsurvplot() displays the absolute number of subjects at risk. If risk.table = “percentage”, the percentage at risk is displayed. Use “abs_pct” to show both the absolute number and the percentage of subjects at risk (#70).
    • -
    • New argument surv.median.line in ggsurvplot(): character vector for drawing a horizontal/vertical line at median (50%) survival. Allowed values include one of c(“none”, “hv”, “h”, “v”). v: vertical, h:horizontal (#61).
    • -
    • Now, default theme of ggcoxdiagnostics() is ggplot2::theme_bw().
    • -
    -
    -
    -

    -Bug fixes

    -
      -
    • -ggcoxdiagnostics() can now handle a multivariate Cox model (#62)
    • -
    • -ggcoxfunctional() now displays graphs of continuous variable against martingale residuals of null cox proportional hazards model (#63).
    • -
    • When subset is specified in the survfit() model, it’s now considered in ggsurvplot() to report the right p-value on the subset of the data and not on the whole data sets (@jseoane, #71).
    • -
    • -ggcoxzph() can now produce plots only for specified subset of varibles (@MarcinKosinski, #75)
    • -
    -
    -
    -
    -

    -survminer 0.2.2 2016-07-28 -

    -
    -

    -New features

    -
      -
    • New ggcoxdiagnostics function that plots diagnostic graphs for Cox Proportional Hazards model (@MarcinKosinski, #16).
    • -
    • Vignette added: Survival plots have never been so informative (@MarcinKosinski, #39)
    • -
    • New argument linetype in ‘ggsurvplot’ (@MarcinKosinski, #45). Allowed values includes i) “strata” for changing linetypes by strata (i.e. groups); ii) a numeric vector (e.g., c(1, 2)) or a character vector c(“solid”, “dashed”).
    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -survminer 0.2.1 2016-04-23 -

    -
    -

    -New features

    -
      -
    • New ggcoxzph function that displays a graph of the scaled Schoenfeld residuals, along with a smooth curve using ‘ggplot2’. Wrapper around \link{plot.cox.zph}. (@MarcinKosinski, #13)

    • -
    • New ggcoxfunctional function that displays graphs of continuous explanatory variable against martingale residuals of null cox proportional hazards model, for each term in of the right side of input formula. This might help to properly choose the functional form of continuous variable in cox model, since fitted lines with lowess function should be linear to satisfy cox proportional hazards model assumptions. (@MarcinKosinski, #14)

    • -
    • New function theme_classic2: ggplot2 classic theme with axis line. This function replaces ggplot2::theme_classic, which does no longer display axis lines (since ggplot2 v2.1.0)

    • -
    -
    -
    -

    -Minor changes

    -
      -
    • post-customization of color and fill no longer shows warnings like “Scale for ‘fill’ is already present. Adding another scale for ‘fill’, which will replace the existing scale” (@MarcinKosinski, #11).
    • -
    • now, post-customization of survival curve colors will automatically affect the risk table y axis text colors (@MarcinKosinski, #11).
    • -
    • Default value for the argument risk.table.y.text.col is now TRUE.
    • -
    • New argument risk.table.y.text for the function ggsurvplot. logical argument. Default is TRUE. If FALSE, risk table y axis tick labels will be hidden (@MarcinKosinski, #28).
    • -
    -
    -
    -

    -Bug fixes

    - -
    -
    -
    -

    -survminer 0.2.0 2016-02-18 -

    -
    -

    -New features

    -
      -
    • New arguments in ggsurvplot for changing font style, size and color of main title, axis labels, axis tick labels and legend labels: font.main, font.x, font.y, font.tickslab, font.legend.

    • -
    • New arguments risk.table.title, risk.table.fontsize in ggsurvplot

    • -
    • New argument risk.table.y.text.col: logical value. Default value is FALSE. If TRUE, risk table tick labels will be colored by strata (@MarcinKosinski, #8).

    • -
    • print.ggsurvplot() function added: S3 method for class ‘ggsurvplot’.

    • -
    • -

      ggsurvplot returns an object of class ggsurvplot which is list containing two ggplot objects:

      -
        -
      • -plot: the survival plot
      • -
      • -table: the number at risk table per time
      • -
      -
    • -
    • It’s now possible to customize the output survival plot and the risk table returned by ggsurvplot, and to print again the final plot. (@MarcinKosinski, #2):

    • -
    -
    # Fit survival curves
    -require("survival")
    -fit<- survfit(Surv(time, status) ~ sex, data = lung)
    -
    -# visualize
    -require(survminer)
    -ggsurvplot(fit, pval = TRUE, conf.int = TRUE,
    -          risk.table = TRUE)
    -
    -# Customize the output and then print
    -res <- ggsurvplot(fit, pval = TRUE, conf.int = TRUE,
    -           risk.table = TRUE)
    -res$table <- res$table + theme(axis.line = element_blank())
    -res$plot <- res$plot + labs(title = "Survival Curves")
    -print(res)
    -
    -
    -

    -Minor changes

    -
      -
    • p < 0.0001 is used (when pvalue < 0.0001).
    • -
    -
    -
    -

    -Bug fixes

    -
      -
    • ggtheme now affects risk.table (@MarcinKosinski, #1)

    • -
    • xlim changed to cartesian coordinates mode (@MarcinKosinski, #4). The Cartesian coordinate system is the most common type of coordinate system. It will zoom the plot (like you’re looking at it with a magnifying glass), without clipping the data.

    • -
    • Risk table and survival curves have now the same color and the same order

    • -
    • Plot width is no longer too small when legend position = “left” (@MarcinKosinski, #7).

    • -
    -
    -
    -
    -

    -survminer 0.1.1 2016-01-18 -

    -
    -

    -New features

    -
      -
    • -ggsurvplot(): Drawing survival curves using ggplot2
    • -
    -
    -
    -
    - - - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/pkgdown.css b/docs/pkgdown.css deleted file mode 100644 index c01e592..0000000 --- a/docs/pkgdown.css +++ /dev/null @@ -1,367 +0,0 @@ -/* Sticky footer */ - -/** - * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ - * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css - * - * .Site -> body > .container - * .Site-content -> body > .container .row - * .footer -> footer - * - * Key idea seems to be to ensure that .container and __all its parents__ - * have height set to 100% - * - */ - -html, body { - height: 100%; -} - -body { - position: relative; -} - -body > .container { - display: flex; - height: 100%; - flex-direction: column; -} - -body > .container .row { - flex: 1 0 auto; -} - -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - color: #666; - display: flex; - flex-shrink: 0; -} -footer p { - margin-bottom: 0; -} -footer div { - flex: 1; -} -footer .pkgdown { - text-align: right; -} -footer p { - margin-bottom: 0; -} - -img.icon { - float: right; -} - -img { - max-width: 100%; -} - -/* Fix bug in bootstrap (only seen in firefox) */ -summary { - display: list-item; -} - -/* Typographic tweaking ---------------------------------*/ - -.contents .page-header { - margin-top: calc(-60px + 1em); -} - -dd { - margin-left: 3em; -} - -/* Section anchors ---------------------------------*/ - -a.anchor { - margin-left: -30px; - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; -} - -.hasAnchor:hover a.anchor { - visibility: visible; -} - -@media (max-width: 767px) { - .hasAnchor:hover a.anchor { - visibility: hidden; - } -} - - -/* Fixes for fixed navbar --------------------------*/ - -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 60px; - margin-top: -40px; -} - -/* Navbar submenu --------------------------*/ - -.dropdown-submenu { - position: relative; -} - -.dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - border-radius: 0 6px 6px 6px; -} - -.dropdown-submenu:hover>.dropdown-menu { - display: block; -} - -.dropdown-submenu>a:after { - display: block; - content: " "; - float: right; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: #cccccc; - margin-top: 5px; - margin-right: -10px; -} - -.dropdown-submenu:hover>a:after { - border-left-color: #ffffff; -} - -.dropdown-submenu.pull-left { - float: none; -} - -.dropdown-submenu.pull-left>.dropdown-menu { - left: -100%; - margin-left: 10px; - border-radius: 6px 0 6px 6px; -} - -/* Sidebar --------------------------*/ - -#pkgdown-sidebar { - margin-top: 30px; - position: -webkit-sticky; - position: sticky; - top: 70px; -} - -#pkgdown-sidebar h2 { - font-size: 1.5em; - margin-top: 1em; -} - -#pkgdown-sidebar h2:first-child { - margin-top: 0; -} - -#pkgdown-sidebar .list-unstyled li { - margin-bottom: 0.5em; -} - -/* bootstrap-toc tweaks ------------------------------------------------------*/ - -/* All levels of nav */ - -nav[data-toggle='toc'] .nav > li > a { - padding: 4px 20px 4px 6px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; -} - -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 5px; - color: inherit; - border-left: 1px solid #878787; -} - -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 5px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; - border-left: 2px solid #878787; -} - -/* Nav: second level (shown on .active) */ - -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} - -nav[data-toggle='toc'] .nav .nav > li > a { - padding-left: 16px; - font-size: 1.35rem; -} - -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 15px; -} - -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 15px; - font-weight: 500; - font-size: 1.35rem; -} - -/* orcid ------------------------------------------------------------------- */ - -.orcid { - font-size: 16px; - color: #A6CE39; - /* margins are required by official ORCID trademark and display guidelines */ - margin-left:4px; - margin-right:4px; - vertical-align: middle; -} - -/* Reference index & topics ----------------------------------------------- */ - -.ref-index th {font-weight: normal;} - -.ref-index td {vertical-align: top;} -.ref-index .icon {width: 40px;} -.ref-index .alias {width: 40%;} -.ref-index-icons .alias {width: calc(40% - 40px);} -.ref-index .title {width: 60%;} - -.ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top;} -.ref-arguments .name {width: 20%;} -.ref-arguments .desc {width: 80%;} - -/* Nice scrolling for wide elements --------------------------------------- */ - -table { - display: block; - overflow: auto; -} - -/* Syntax highlighting ---------------------------------------------------- */ - -pre { - word-wrap: normal; - word-break: normal; - border: 1px solid #eee; -} - -pre, code { - background-color: #f8f8f8; - color: #333; -} - -pre code { - overflow: auto; - word-wrap: normal; - white-space: pre; -} - -pre .img { - margin: 5px 0; -} - -pre .img img { - background-color: #fff; - display: block; - height: auto; -} - -code a, pre a { - color: #375f84; -} - -a.sourceLine:hover { - text-decoration: none; -} - -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #888888;} /* comment */ - -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: #6A0366; font-weight: bolder;} - -/* Clipboard --------------------------*/ - -.hasCopyButton { - position: relative; -} - -.btn-copy-ex { - position: absolute; - right: 0; - top: 0; - visibility: hidden; -} - -.hasCopyButton:hover button.btn-copy-ex { - visibility: visible; -} - -/* headroom.js ------------------------ */ - -.headroom { - will-change: transform; - transition: transform 200ms linear; -} -.headroom--pinned { - transform: translateY(0%); -} -.headroom--unpinned { - transform: translateY(-100%); -} - -/* mark.js ----------------------------*/ - -mark { - background-color: rgba(255, 255, 51, 0.5); - border-bottom: 2px solid rgba(255, 153, 51, 0.3); - padding: 1px; -} - -/* vertical spacing after htmlwidgets */ -.html-widget { - margin-bottom: 10px; -} - -/* fontawesome ------------------------ */ - -.fab { - font-family: "Font Awesome 5 Brands" !important; -} - -/* don't display links in code chunks when printing */ -/* source: https://stackoverflow.com/a/10781533 */ -@media print { - code a:link:after, code a:visited:after { - content: ""; - } -} diff --git a/docs/pkgdown.js b/docs/pkgdown.js deleted file mode 100644 index 7e7048f..0000000 --- a/docs/pkgdown.js +++ /dev/null @@ -1,108 +0,0 @@ -/* http://gregfranko.com/blog/jquery-best-practices/ */ -(function($) { - $(function() { - - $('.navbar-fixed-top').headroom(); - - $('body').css('padding-top', $('.navbar').height() + 10); - $(window).resize(function(){ - $('body').css('padding-top', $('.navbar').height() + 10); - }); - - $('[data-toggle="tooltip"]').tooltip(); - - var cur_path = paths(location.pathname); - var links = $("#navbar ul li a"); - var max_length = -1; - var pos = -1; - for (var i = 0; i < links.length; i++) { - if (links[i].getAttribute("href") === "#") - continue; - // Ignore external links - if (links[i].host !== location.host) - continue; - - var nav_path = paths(links[i].pathname); - - var length = prefix_length(nav_path, cur_path); - if (length > max_length) { - max_length = length; - pos = i; - } - } - - // Add class to parent
  • , and enclosing
  • if in dropdown - if (pos >= 0) { - var menu_anchor = $(links[pos]); - menu_anchor.parent().addClass("active"); - menu_anchor.closest("li.dropdown").addClass("active"); - } - }); - - function paths(pathname) { - var pieces = pathname.split("/"); - pieces.shift(); // always starts with / - - var end = pieces[pieces.length - 1]; - if (end === "index.html" || end === "") - pieces.pop(); - return(pieces); - } - - // Returns -1 if not found - function prefix_length(needle, haystack) { - if (needle.length > haystack.length) - return(-1); - - // Special case for length-0 haystack, since for loop won't run - if (haystack.length === 0) { - return(needle.length === 0 ? 0 : -1); - } - - for (var i = 0; i < haystack.length; i++) { - if (needle[i] != haystack[i]) - return(i); - } - - return(haystack.length); - } - - /* Clipboard --------------------------*/ - - function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); - $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); - } - - if(ClipboardJS.isSupported()) { - $(document).ready(function() { - var copyButton = ""; - - $(".examples, div.sourceCode").addClass("hasCopyButton"); - - // Insert copy buttons: - $(copyButton).prependTo(".hasCopyButton"); - - // Initialize tooltips: - $('.btn-copy-ex').tooltip({container: 'body'}); - - // Initialize clipboard: - var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { - text: function(trigger) { - return trigger.parentNode.textContent; - } - }); - - clipboardBtnCopies.on('success', function(e) { - changeTooltipMessage(e.trigger, 'Copied!'); - e.clearSelection(); - }); - - clipboardBtnCopies.on('error', function() { - changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); - }); - }); - } -})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml deleted file mode 100644 index ac5a155..0000000 --- a/docs/pkgdown.yml +++ /dev/null @@ -1,10 +0,0 @@ -pandoc: 2.7.3 -pkgdown: 1.5.1 -pkgdown_sha: ~ -articles: - Informative_Survival_Plots: Informative_Survival_Plots.html - Playing_with_fonts_and_texts: Playing_with_fonts_and_texts.html - Specifiying_weights_in_log-rank_comparisons: Specifiying_weights_in_log-rank_comparisons.html - ggforest-show-interactions-hazard-ratio: ggforest-show-interactions-hazard-ratio.html -last_built: 2021-03-09T08:33Z - diff --git a/docs/reference/BMT-1.png b/docs/reference/BMT-1.png deleted file mode 100644 index d927e05..0000000 Binary files a/docs/reference/BMT-1.png and /dev/null differ diff --git a/docs/reference/BMT-2.png b/docs/reference/BMT-2.png deleted file mode 100644 index 8181a8e..0000000 Binary files a/docs/reference/BMT-2.png and /dev/null differ diff --git a/docs/reference/BMT.html b/docs/reference/BMT.html deleted file mode 100644 index 4e20708..0000000 --- a/docs/reference/BMT.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - -Bone Marrow Transplant — BMT • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Bone marrow transplant data from L Scrucca et aL., Bone Marrow - Transplantation (2007). Data from 35 patients with acute leukaemia who - underwent HSCT. Used for competing risk analysis.

    -
    - -
    data("BMT")
    - - -

    Format

    - -

    A data frame with 35 rows and 3 columns.

    -- dis: disease; 0 = ALL; 1 = AML
    -- ftime: follow-up time
    -- status: 0 = censored (survival); 1 = Transplant-related mortality; 2 = relapse
    -
    - -

    References

    - -

    Scrucca L, Santucci A, Aversa F. Competing risk analysis using R: - an easy guide for clinicians. Bone Marrow Transplant. 2007 Aug;40(4):381-7.

    - -

    Examples

    -
    data(BMT) -if(require("cmprsk")){ - -# Data preparaion -#+++++++++++++++++++++ -# Label diseases -BMT$dis <- factor(BMT$dis, levels = c(0,1), - labels = c("ALL", "AML")) -# Label status -BMT$status <- factor(BMT$status, levels = c(0,1,2), - labels = c("Censored","Mortality","Relapse")) - -# Cumulative Incidence Function -# ++++++++++++++++++++++++++ -fit <- cmprsk::cuminc( - ftime = BMT$ftime, # Failure time variable - fstatus = BMT$status, # Codes for different causes of failure - group = BMT$dis # Estimates will calculated within groups - ) - -# Visualize -# +++++++++++++++++++++++ -ggcompetingrisks(fit) -ggcompetingrisks(fit, multiple_panels = FALSE, - legend = "right") - -}
    #> Le chargement a nécessité le package : cmprsk
    #> Le chargement a nécessité le package : survival
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/BRCAOV.survInfo-1.png b/docs/reference/BRCAOV.survInfo-1.png deleted file mode 100644 index d51fdf4..0000000 Binary files a/docs/reference/BRCAOV.survInfo-1.png and /dev/null differ diff --git a/docs/reference/BRCAOV.survInfo.html b/docs/reference/BRCAOV.survInfo.html deleted file mode 100644 index a64fe73..0000000 --- a/docs/reference/BRCAOV.survInfo.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - -Breast and Ovarian Cancers Survival Information — BRCAOV.survInfo • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Breat and Ovarian cancers survival information from the - RTCGA.clinical R/Bioconductor package.http://rtcga.github.io/RTCGA/.

    -
    - -
    data("BRCAOV.survInfo")
    - - -

    Format

    - -

    A data frame with 1674 rows and 4 columns.

    - - times: follow-up time;
    - - bcr_patient_barcode: Patient bar code;
    - - patient.vital_status = survival status. 0 = alive, 1 = dead;
    - - admin.disease_code: disease code. brca = breast cancer, ov = ovarian
    - cancer.
    - 
    - -

    Source

    - -

    From the RTCGA.clinical R/Bioconductor package. The data is generated as follow:

    -
    -# Installing RTCGA.clinical
    -source("https://bioconductor.org/biocLite.R")
    -biocLite("RTCGA.clinical")
    -
    -# Generating the BRCAOV survival information
    -library(RTCGA.clinical)
    -survivalTCGA(BRCA.clinical, OV.clinical,
    -extract.cols = "admin.disease_code") -&gt; BRCAOV.survInfo
    -
    - - -

    Examples

    -
    data(BRCAOV.survInfo) -library(survival) -fit <- survfit(Surv(times, patient.vital_status) ~ admin.disease_code, - data = BRCAOV.survInfo) -ggsurvplot(fit, data = BRCAOV.survInfo, risk.table = TRUE)
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/add_ggsurvplot-1.png b/docs/reference/add_ggsurvplot-1.png deleted file mode 100644 index bdb276c..0000000 Binary files a/docs/reference/add_ggsurvplot-1.png and /dev/null differ diff --git a/docs/reference/add_ggsurvplot-2.png b/docs/reference/add_ggsurvplot-2.png deleted file mode 100644 index 36fe96b..0000000 Binary files a/docs/reference/add_ggsurvplot-2.png and /dev/null differ diff --git a/docs/reference/add_ggsurvplot.html b/docs/reference/add_ggsurvplot.html deleted file mode 100644 index 63cf234..0000000 --- a/docs/reference/add_ggsurvplot.html +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - -Add Components to a ggsurvplot — add_ggsurvplot • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Allows to add ggplot components - theme(), labs(), ... - to an - object of class ggsurv, which is a list of ggplots.

    -
    - -
    # S3 method for ggsurv
    -+(e1, e2)
    -
    -e1 %++% e2
    - -

    Arguments

    - - - - - - - - - - -
    e1

    an object of class ggsurv.

    e2

    a plot component such as theme and labs.

    - -

    See also

    - - - -

    Examples

    -
    # Fit survival curves -require("survival") -fit<- survfit(Surv(time, status) ~ sex, data = lung) - -# Basic survival curves -p <- ggsurvplot(fit, data = lung, risk.table = TRUE, - main = "Survival curve", - submain = "Based on Kaplan-Meier estimates", - caption = "created with survminer" - ) -p
    -# Customizing the plots -p + theme_survminer( - font.main = c(16, "bold", "darkblue"), - font.submain = c(15, "bold.italic", "purple"), - font.caption = c(14, "plain", "orange"), - font.x = c(14, "bold.italic", "red"), - font.y = c(14, "bold.italic", "darkred"), - font.tickslab = c(12, "plain", "darkgreen") -)
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/arrange_ggsurvplots-1.png b/docs/reference/arrange_ggsurvplots-1.png deleted file mode 100644 index 62cd355..0000000 Binary files a/docs/reference/arrange_ggsurvplots-1.png and /dev/null differ diff --git a/docs/reference/arrange_ggsurvplots.html b/docs/reference/arrange_ggsurvplots.html deleted file mode 100644 index 88f848e..0000000 --- a/docs/reference/arrange_ggsurvplots.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - -Arranging Multiple ggsurvplots — arrange_ggsurvplots • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Arranging multiple ggsurvplots on the same page.

    -
    - -
    arrange_ggsurvplots(
    -  x,
    -  print = TRUE,
    -  title = NA,
    -  ncol = 2,
    -  nrow = 1,
    -  surv.plot.height = NULL,
    -  risk.table.height = NULL,
    -  ncensor.plot.height = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    x

    a list of ggsurvplots.

    print

    logical value. If TRUE, the arranged plots are displayed.

    title

    character vector specifying page title. Default is NA.

    ncol, nrow

    the number of columns and rows, respectively.

    surv.plot.height

    the height of the survival plot on the grid. Default -is 0.75. Ignored when risk.table = FALSE. 1-risk.table.height - -ncensor.plot.height when risk.table = TRUE and ncensor.plot = -TRUE

    risk.table.height

    the height of the risk table on the grid. Increase -the value when you have many strata. Default is 0.25. Ignored when -risk.table = FALSE.

    ncensor.plot.height

    The height of the censor plot. Used when -ncensor.plot = TRUE.

    ...

    not used

    - -

    Value

    - -

    returns an invisible object of class arrangelist (see - marrangeGrob), which can be saved into a pdf file using - the function ggsave.

    - -

    Examples

    -
    -# Fit survival curves -require("survival") -fit<- survfit(Surv(time, status) ~ sex, data = lung) - -# List of ggsurvplots -require("survminer") -splots <- list() -splots[[1]] <- ggsurvplot(fit, data = lung, risk.table = TRUE, ggtheme = theme_minimal()) -splots[[2]] <- ggsurvplot(fit, data = lung, risk.table = TRUE, ggtheme = theme_grey()) - -# Arrange multiple ggsurvplots and print the output -arrange_ggsurvplots(splots, print = TRUE, - ncol = 2, nrow = 1, risk.table.height = 0.4)
    -if (FALSE) { -# Arrange and save into pdf file -res <- arrange_ggsurvplots(splots, print = FALSE) -ggsave("myfile.pdf", res) -}
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggadjustedcurves-1.png b/docs/reference/ggadjustedcurves-1.png deleted file mode 100644 index a5753ce..0000000 Binary files a/docs/reference/ggadjustedcurves-1.png and /dev/null differ diff --git a/docs/reference/ggadjustedcurves-2.png b/docs/reference/ggadjustedcurves-2.png deleted file mode 100644 index ab9a880..0000000 Binary files a/docs/reference/ggadjustedcurves-2.png and /dev/null differ diff --git a/docs/reference/ggadjustedcurves-3.png b/docs/reference/ggadjustedcurves-3.png deleted file mode 100644 index 9046632..0000000 Binary files a/docs/reference/ggadjustedcurves-3.png and /dev/null differ diff --git a/docs/reference/ggadjustedcurves-4.png b/docs/reference/ggadjustedcurves-4.png deleted file mode 100644 index de5f2a0..0000000 Binary files a/docs/reference/ggadjustedcurves-4.png and /dev/null differ diff --git a/docs/reference/ggadjustedcurves-5.png b/docs/reference/ggadjustedcurves-5.png deleted file mode 100644 index 86b0339..0000000 Binary files a/docs/reference/ggadjustedcurves-5.png and /dev/null differ diff --git a/docs/reference/ggadjustedcurves.html b/docs/reference/ggadjustedcurves.html deleted file mode 100644 index 0feb9e6..0000000 --- a/docs/reference/ggadjustedcurves.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - -Adjusted Survival Curves for Cox Proportional Hazards Model — ggadjustedcurves • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    The function surv_adjustedcurves() calculates while the function ggadjustedcurves() plots adjusted survival curves for the coxph model. -The main idea behind this function is to present expected survival curves calculated based on Cox model separately for subpopulations. The very detailed description and interesting discussion of adjusted curves is presented in 'Adjusted Survival Curves' by Terry Therneau, Cynthia Crowson, Elizabeth Atkinson (2015) https://cran.r-project.org/web/packages/survival/vignettes/adjcurve.pdf. -Many approaches are discussed in this article. Currently four approaches (two unbalanced, one conditional and one marginal) are implemented in the ggadjustedcurves() function. See the section Details.

    -
    - -
    ggadjustedcurves(
    -  fit,
    -  variable = NULL,
    -  data = NULL,
    -  reference = NULL,
    -  method = "conditional",
    -  fun = NULL,
    -  palette = "hue",
    -  ylab = "Survival rate",
    -  size = 1,
    -  ggtheme = theme_survminer(),
    -  ...
    -)
    -
    -surv_adjustedcurves(
    -  fit,
    -  variable = NULL,
    -  data = NULL,
    -  reference = NULL,
    -  method = "conditional",
    -  size = 1,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class coxph.object - created with coxph function.

    variable

    a character, name of the grouping variable to be plotted. If not supplied then it will be extracted from the model formula from the strata() component. If there is no strata() component then only a single curve will be plotted - average for the thole population.

    data

    a dataset for predictions. If not supplied then data will be extracted from the fit object.

    reference

    a dataset for reference population, to which dependent variables should be balanced. If not specified, then the data will be used instead. Note that the reference dataset should contain all variables used in fit object.

    method

    a character, describes how the expected survival curves shall be calculated. Possible options: -'single' (average for population), 'average' (averages for subpopulations), 'marginal', 'conditional' (averages for subpopulations after rebalancing). See the Details section for further information.

    fun

    an arbitrary function defining a transformation of the survival -curve. Often used transformations can be specified with a character -argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the -cumulative hazard function (f(y) = -log(y)), and "pct" for survival -probability in percentage.

    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    ylab

    a label for oy axis.

    size

    the curve size.

    ggtheme

    function, ggplot2 theme name. Allowed values include ggplot2 official themes: see theme.

    ...

    further arguments passed to the function ggpar for customizing the plot.

    - -

    Value

    - -

    Returns an object of class gg.

    -

    Details

    - -

    Currently four approaches are implemented in the ggadjustedcurves() function.

    -

    For method = "single" a single survival curve is calculated and plotted. The curve presents an expected survival calculated for population data calculated based on the Cox model fit.

    -

    For method = "average" a separate survival curve is plotted for each level of a variable listed as variable. If this argument is not specified, then it will be extracted from the strata component of fit argument. Each curve presents an expected survival calculated for subpopulation from data based on a Cox model fit. Note that in this method subpopulations are NOT balanced.

    -

    For method = "marginal" a survival curve is plotted for each level of a grouping variable selected by variable argument. If this argument is not specified, then it will be extracted from the strata component of fit object. Subpopulations are balanced with respect to variables in the fit formula to keep distributions similar to these in the reference population. If no reference population is specified, then the whole data is used as a reference population instead. The balancing is performed in a following way: (1) for each subpopulation a logistic regression model is created to model the odds of being in the subpopulation against the reference population given the other variables listed in a fit object, (2) reverse probabilities of belonging to a specified subpopulation are used as weights in the Cox model, (3) the Cox model is refitted with weights taken into account, (4) expected survival curves are calculated for each subpopulation based on a refitted weighted model.

    -

    For method = "conditional" a separate survival curve is plotted for each level of a grouping variable selected by variable argument. If this argument is not specified, then it will be extracted from the strata component of fit object. Subpopulations are balanced in a following way: (1) the data is replicated as many times as many subpopulations are considered (say k), (2) for each row in original data a set of k copies are created and for every copy a different value of a grouping variable is assigned, this will create a new dataset balanced in terms of grouping variables, (3) expected survival is calculated for each subpopulation based on the new artificial dataset. Here the model fit is not refitted.

    -

    Note that surv_adjustedcurves function calculates survival curves and based on this function one can calculate median survival.

    - -

    Examples

    -
    -library(survival) -fit2 <- coxph( Surv(stop, event) ~ size, data = bladder ) -# single curve -ggadjustedcurves(fit2, data = bladder)
    curve <- surv_adjustedcurves(fit2, data = bladder) - -fit2 <- coxph( Surv(stop, event) ~ size + strata(rx), data = bladder ) -# average in groups -ggadjustedcurves(fit2, data = bladder, method = "average", variable = "rx")
    curve <- surv_adjustedcurves(fit2, data = bladder, method = "average", variable = "rx") - -# conditional balancing in groups -ggadjustedcurves(fit2, data = bladder, method = "marginal", variable = "rx")
    curve <- surv_adjustedcurves(fit2, data = bladder, method = "marginal", variable = "rx") - -# selected reference population -ggadjustedcurves(fit2, data = bladder, method = "marginal", variable = "rx", - reference = bladder[bladder$rx == "1",])
    -# conditional balancing in groups -ggadjustedcurves(fit2, data = bladder, method = "conditional", variable = "rx")
    curve <- surv_adjustedcurves(fit2, data = bladder, method = "conditional", variable = "rx") - -if (FALSE) { -# this will take some time -fdata <- flchain[flchain$futime >=7,] -fdata$age2 <- cut(fdata$age, c(0,54, 59,64, 69,74,79, 89, 110), - labels = c(paste(c(50,55,60,65,70,75,80), - c(54,59,64,69,74,79,89), sep='-'), "90+")) -fdata$group <- factor(1+ 1*(fdata$flc.grp >7) + 1*(fdata$flc.grp >9), - levels=1:3, - labels=c("FLC < 3.38", "3.38 - 4.71", "FLC > 4.71")) -# single curve -fit <- coxph( Surv(futime, death) ~ age*sex, data = fdata) -ggadjustedcurves(fit, data = fdata, method = "single") - -# average in groups -fit <- coxph( Surv(futime, death) ~ age*sex + strata(group), data = fdata) -ggadjustedcurves(fit, data = fdata, method = "average") - -# conditional balancing in groups -ggadjustedcurves(fit, data = fdata, method = "conditional") - -# marginal balancing in groups -ggadjustedcurves(fit, data = fdata, method = "marginal", reference = fdata) -}
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggcompetingrisks-1.png b/docs/reference/ggcompetingrisks-1.png deleted file mode 100644 index cee06f0..0000000 Binary files a/docs/reference/ggcompetingrisks-1.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks-2.png b/docs/reference/ggcompetingrisks-2.png deleted file mode 100644 index 1e0e487..0000000 Binary files a/docs/reference/ggcompetingrisks-2.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks-3.png b/docs/reference/ggcompetingrisks-3.png deleted file mode 100644 index ad29afa..0000000 Binary files a/docs/reference/ggcompetingrisks-3.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks-4.png b/docs/reference/ggcompetingrisks-4.png deleted file mode 100644 index 70c0bb3..0000000 Binary files a/docs/reference/ggcompetingrisks-4.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks-5.png b/docs/reference/ggcompetingrisks-5.png deleted file mode 100644 index becc9c8..0000000 Binary files a/docs/reference/ggcompetingrisks-5.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks-6.png b/docs/reference/ggcompetingrisks-6.png deleted file mode 100644 index cee06f0..0000000 Binary files a/docs/reference/ggcompetingrisks-6.png and /dev/null differ diff --git a/docs/reference/ggcompetingrisks.html b/docs/reference/ggcompetingrisks.html deleted file mode 100644 index 6ad9d48..0000000 --- a/docs/reference/ggcompetingrisks.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - -Cumulative Incidence Curves for Competing Risks — ggcompetingrisks • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    This function plots Cumulative Incidence Curves. For cuminc objects it's a ggplot2 version of plot.cuminc. -For survfitms objects a different geometry is used, as suggested by @teigentler.

    -
    - -
    ggcompetingrisks(
    -  fit,
    -  gnames = NULL,
    -  gsep = " ",
    -  multiple_panels = TRUE,
    -  ggtheme = theme_survminer(),
    -  coef = 1.96,
    -  conf.int = FALSE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of a class cmprsk::cuminc - created with cmprsk::cuminc function or survfitms created with survfit function.

    gnames

    a vector with group names. If not supplied then will be extracted from fit object (cuminc only).

    gsep

    a separator that extracts group names and event names from gnames object (cuminc only).

    multiple_panels

    if TRUE then groups will be plotted in different panels (cuminc only).

    ggtheme

    function, ggplot2 theme name. Default value is theme_survminer. -Allowed values include ggplot2 official themes: see theme.

    coef

    see conf.int, scaling actor for the ribbon. The default value is 1.96.

    conf.int

    if TRUE then additional layer (geom_ribbon) is added around the point estimate. The ribon is plotted with boundries +- coef*standard deviation.

    ...

    further arguments passed to the function ggpar for customizing the plot.

    - -

    Value

    - -

    Returns an object of class gg.

    - -

    Examples

    -
    if (FALSE) { -if(require("cmprsk")){ - -set.seed(2) -ss <- rexp(100) -gg <- factor(sample(1:3,100,replace=TRUE),1:3,c('BRCA','LUNG','OV')) -cc <- factor(sample(0:2,100,replace=TRUE),0:2,c('no event', 'death', 'progression')) -strt <- sample(1:2,100,replace=TRUE) - -# handles cuminc objects -print(fit <- cmprsk::cuminc(ss,cc,gg,strt)) -ggcompetingrisks(fit) -ggcompetingrisks(fit, multiple_panels = FALSE) -ggcompetingrisks(fit, conf.int = TRUE) -ggcompetingrisks(fit, multiple_panels = FALSE, conf.int = TRUE) - -# handles survfitms objects -library(survival) -df <- data.frame(time = ss, group = gg, status = cc, strt) -fit2 <- survfit(Surv(time, status, type="mstate") ~ 1, data=df) -ggcompetingrisks(fit2) -fit3 <- survfit(Surv(time, status, type="mstate") ~ group, data=df) -ggcompetingrisks(fit3) -} - - library(ggsci) - library(cowplot) - ggcompetingrisks(fit3) + theme_cowplot() + scale_fill_jco() -}
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggcoxdiagnostics-1.png b/docs/reference/ggcoxdiagnostics-1.png deleted file mode 100644 index e227c4f..0000000 Binary files a/docs/reference/ggcoxdiagnostics-1.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-2.png b/docs/reference/ggcoxdiagnostics-2.png deleted file mode 100644 index 4ccec6e..0000000 Binary files a/docs/reference/ggcoxdiagnostics-2.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-3.png b/docs/reference/ggcoxdiagnostics-3.png deleted file mode 100644 index cd1f2dd..0000000 Binary files a/docs/reference/ggcoxdiagnostics-3.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-4.png b/docs/reference/ggcoxdiagnostics-4.png deleted file mode 100644 index 6dbfb22..0000000 Binary files a/docs/reference/ggcoxdiagnostics-4.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-5.png b/docs/reference/ggcoxdiagnostics-5.png deleted file mode 100644 index 6b475b5..0000000 Binary files a/docs/reference/ggcoxdiagnostics-5.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-6.png b/docs/reference/ggcoxdiagnostics-6.png deleted file mode 100644 index 54d7c7e..0000000 Binary files a/docs/reference/ggcoxdiagnostics-6.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics-7.png b/docs/reference/ggcoxdiagnostics-7.png deleted file mode 100644 index 4cf6b76..0000000 Binary files a/docs/reference/ggcoxdiagnostics-7.png and /dev/null differ diff --git a/docs/reference/ggcoxdiagnostics.html b/docs/reference/ggcoxdiagnostics.html deleted file mode 100644 index 7529edc..0000000 --- a/docs/reference/ggcoxdiagnostics.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - -Diagnostic Plots for Cox Proportional Hazards Model with ggplot2 — ggcoxdiagnostics • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Displays diagnostics graphs presenting goodness of Cox Proportional Hazards Model fit, that -can be calculated with coxph function.

    -
    - -
    ggcoxdiagnostics(
    -  fit,
    -  type = c("martingale", "deviance", "score", "schoenfeld", "dfbeta", "dfbetas",
    -    "scaledsch", "partial"),
    -  ...,
    -  linear.predictions = type %in% c("martingale", "deviance"),
    -  ox.scale = ifelse(linear.predictions, "linear.predictions", "observation.id"),
    -  hline = TRUE,
    -  sline = TRUE,
    -  sline.se = TRUE,
    -  hline.col = "red",
    -  hline.size = 1,
    -  hline.alpha = 1,
    -  hline.yintercept = 0,
    -  hline.lty = "dashed",
    -  sline.col = "blue",
    -  sline.size = 1,
    -  sline.alpha = 0.3,
    -  sline.lty = "dashed",
    -  point.col = "black",
    -  point.size = 1,
    -  point.shape = 19,
    -  point.alpha = 1,
    -  title = NULL,
    -  subtitle = NULL,
    -  caption = NULL,
    -  ggtheme = ggplot2::theme_bw()
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class coxph.object - created with coxph function.

    type

    the type of residuals to present on Y axis of a diagnostic plot. -The same as in residuals.coxph: character string indicating the type of -residual desired. Possible values are "martingale", "deviance", "score", "schoenfeld", "dfbeta", "dfbetas" -and "scaledsch". Only enough of the string to -determine a unique match is required.

    ...

    further arguments passed to residuals.coxph or -to the function ggpar for customizing the plot.

    linear.predictions

    (deprecated, see ox.scale) a logical value indicating whether to show linear -predictions for observations (TRUE) or just indexed of observations -(FALSE) on X axis.

    ox.scale

    one value from c("linear.predictions", "observation.id", "time"). -It defines what will be presented on OX scale. Possible values: y hat for "linear.predictions", -Id of an observation for "observation.id" or Time for "time".

    hline

    a logical - should the horizontal line be added to highlight the Y=0 level.

    sline, sline.se

    a logical - should the smooth line be added to highlight the local average for residuals.

    hline.col, hline.size, hline.lty, hline.alpha, hline.yintercept

    color, size, linetype, visibility and Y-axis coordinate to be used for geom_hline. -Used only when hline = TRUE.

    sline.col, sline.size, sline.lty, sline.alpha

    color, size, linetype and visibility to be used for geom_smooth. -Used only when sline = TRUE.

    point.col, point.size, point.shape, point.alpha

    color, size, shape and visibility to be used for points.

    title, subtitle, caption

    main title, subtitle and caption.

    ggtheme

    function, ggplot2 theme name. Default value is ggplot2::theme_bw(). -Allowed values include ggplot2 official themes: see theme.

    - -

    Value

    - -

    Returns an object of class ggplot.

    -

    Functions

    - - -
      -
    • ggcoxdiagnostics: Diagnostic Plots for Cox Proportional Hazards Model with ggplot2

    • -
    - -

    Examples

    -
    -library(survival) -coxph.fit2 <- coxph(Surv(futime, fustat) ~ age + ecog.ps, data=ovarian) -ggcoxdiagnostics(coxph.fit2, type = "deviance")
    #> `geom_smooth()` using formula 'y ~ x'
    -ggcoxdiagnostics(coxph.fit2, type = "schoenfeld", title = "Diagnostic plot")
    #> `geom_smooth()` using formula 'y ~ x'
    ggcoxdiagnostics(coxph.fit2, type = "deviance", ox.scale = "time")
    #> Warning: ox.scale='time' works only with type=schoenfeld/scaledsch
    #> `geom_smooth()` using formula 'y ~ x'
    ggcoxdiagnostics(coxph.fit2, type = "schoenfeld", ox.scale = "time", - title = "Diagnostic plot", subtitle = "Data comes from survey XYZ", - font.subtitle = 9)
    #> `geom_smooth()` using formula 'y ~ x'
    ggcoxdiagnostics(coxph.fit2, type = "deviance", ox.scale = "linear.predictions", - caption = "Code is available here - link", font.caption = 10)
    #> `geom_smooth()` using formula 'y ~ x'
    ggcoxdiagnostics(coxph.fit2, type = "schoenfeld", ox.scale = "observation.id")
    #> `geom_smooth()` using formula 'y ~ x'
    ggcoxdiagnostics(coxph.fit2, type = "scaledsch", ox.scale = "time")
    #> `geom_smooth()` using formula 'y ~ x'
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggcoxfunctional-1.png b/docs/reference/ggcoxfunctional-1.png deleted file mode 100644 index e94bb70..0000000 Binary files a/docs/reference/ggcoxfunctional-1.png and /dev/null differ diff --git a/docs/reference/ggcoxfunctional-2.png b/docs/reference/ggcoxfunctional-2.png deleted file mode 100644 index 209a8d2..0000000 Binary files a/docs/reference/ggcoxfunctional-2.png and /dev/null differ diff --git a/docs/reference/ggcoxfunctional.html b/docs/reference/ggcoxfunctional.html deleted file mode 100644 index 4650070..0000000 --- a/docs/reference/ggcoxfunctional.html +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - -Functional Form of Continuous Variable in Cox Proportional Hazards Model — ggcoxfunctional • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Displays graphs of continuous explanatory variable against martingale residuals of null -cox proportional hazards model, for each term in of the right side of formula. This might help to properly -choose the functional form of continuous variable in cox model (coxph). Fitted lines with lowess function -should be linear to satisfy cox proportional hazards model assumptions.

    -
    - -
    ggcoxfunctional(
    -  formula,
    -  data = NULL,
    -  fit,
    -  iter = 0,
    -  f = 0.6,
    -  point.col = "red",
    -  point.size = 1,
    -  point.shape = 19,
    -  point.alpha = 1,
    -  xlim = NULL,
    -  ylim = NULL,
    -  ylab = "Martingale Residuals \nof Null Cox Model",
    -  title = NULL,
    -  caption = NULL,
    -  ggtheme = theme_survminer(),
    -  ...
    -)
    -
    -# S3 method for ggcoxfunctional
    -print(x, ..., newpage = TRUE)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    formula

    a formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the Surv function.

    data

    a data.frame in which to interpret the variables named in the formula,

    fit

    an object of class coxph.object - created with coxph function.

    iter

    parameter of lowess.

    f

    parameter of lowess.

    point.col, point.size, point.shape, point.alpha

    color, size, shape and visibility to be used for points.

    xlim, ylim

    x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    ylab

    y axis label.

    title

    the title of the final grob (top in arrangeGrob)

    caption

    the caption of the final grob (bottom in arrangeGrob)

    ggtheme

    function, ggplot2 theme name. -Allowed values include ggplot2 official themes: see theme.

    ...

    further arguments passed to the function ggpar for customizing the plot.

    x

    an object of class ggcoxfunctional

    newpage

    open a new page. See grid.arrange.

    - -

    Value

    - -

    Returns an object of class ggcoxfunctional which is a list of ggplots.

    -

    Functions

    - - -
      -
    • ggcoxfunctional: Functional Form of Continuous Variable in Cox Proportional Hazards Model.

    • -
    - -

    Examples

    -
    -library(survival) -data(mgus) -res.cox <- coxph(Surv(futime, death) ~ mspike + log(mspike) + I(mspike^2) + - age + I(log(age)^2) + I(sqrt(age)), data = mgus) -ggcoxfunctional(res.cox, data = mgus, point.col = "blue", point.alpha = 0.5)
    ggcoxfunctional(res.cox, data = mgus, point.col = "blue", point.alpha = 0.5, - title = "Pass the title", caption = "Pass the caption")
    - -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggcoxzph-1.png b/docs/reference/ggcoxzph-1.png deleted file mode 100644 index 748e39c..0000000 Binary files a/docs/reference/ggcoxzph-1.png and /dev/null differ diff --git a/docs/reference/ggcoxzph-2.png b/docs/reference/ggcoxzph-2.png deleted file mode 100644 index 88498c0..0000000 Binary files a/docs/reference/ggcoxzph-2.png and /dev/null differ diff --git a/docs/reference/ggcoxzph-3.png b/docs/reference/ggcoxzph-3.png deleted file mode 100644 index b338d09..0000000 Binary files a/docs/reference/ggcoxzph-3.png and /dev/null differ diff --git a/docs/reference/ggcoxzph.html b/docs/reference/ggcoxzph.html deleted file mode 100644 index 5bf2337..0000000 --- a/docs/reference/ggcoxzph.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - -Graphical Test of Proportional Hazards with ggplot2 — ggcoxzph • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Displays a graph of the scaled Schoenfeld residuals, along with a - smooth curve using ggplot2. Wrapper around plot.cox.zph.

    -
    - -
    ggcoxzph(
    -  fit,
    -  resid = TRUE,
    -  se = TRUE,
    -  df = 4,
    -  nsmo = 40,
    -  var,
    -  point.col = "red",
    -  point.size = 1,
    -  point.shape = 19,
    -  point.alpha = 1,
    -  caption = NULL,
    -  ggtheme = theme_survminer(),
    -  ...
    -)
    -
    -# S3 method for ggcoxzph
    -print(x, ..., newpage = TRUE)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class cox.zph.

    resid

    a logical value, if TRUE the residuals are included on the plot, -as well as the smooth fit.

    se

    a logical value, if TRUE, confidence bands at two standard errors -will be added.

    df

    the degrees of freedom for the fitted natural spline, df=2 leads to -a linear fit.

    nsmo

    number of points used to plot the fitted spline.

    var

    the set of variables for which plots are desired. By default, plots -are produced in turn for each variable of a model.

    point.col, point.size, point.shape, point.alpha

    color, size, shape and visibility to be used for points.

    caption

    the caption of the final grob (bottom in arrangeGrob)

    ggtheme

    function, ggplot2 theme name. -Allowed values include ggplot2 official themes: see theme.

    ...

    further arguments passed to either the print() function or to the ggpar function for customizing the plot (see Details section).

    x

    an object of class ggcoxzph

    newpage

    open a new page. See grid.arrange.

    - -

    Value

    - -

    Returns an object of class ggcoxzph which is a list of ggplots.

    -

    Details

    - -

    Customizing the plots: The plot can be easily - customized using additional arguments to be passed to the function ggpar(). - Read ?ggpubr::ggpar. These arguments include - font.main,font.submain,font.caption,font.x,font.y,font.tickslab,font.legend: - a vector of length 3 indicating respectively the size (e.g.: 14), the style - (e.g.: "plain", "bold", "italic", "bold.italic") and the color (e.g.: "red") - of main title, subtitle, caption, xlab and ylab and axis tick labels, - respectively. For example font.x = c(14, "bold", "red"). Use font.x - = 14, to change only font size; or use font.x = "bold", to change only font - face.

    -

    Functions

    - - -
      -
    • ggcoxzph: Graphical Test of Proportional Hazards using ggplot2.

    • -
    - -

    Examples

    -
    -library(survival) -fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps + rx, data=ovarian) -cox.zph.fit <- cox.zph(fit) -# plot all variables -ggcoxzph(cox.zph.fit)
    # plot all variables in specified order -ggcoxzph(cox.zph.fit, var = c("ecog.ps", "rx", "age"), font.main = 12)
    # plot specified variables in specified order -ggcoxzph(cox.zph.fit, var = c("ecog.ps", "rx"), font.main = 12, caption = "Caption goes here")
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggflexsurvplot-1.png b/docs/reference/ggflexsurvplot-1.png deleted file mode 100644 index 829d1a8..0000000 Binary files a/docs/reference/ggflexsurvplot-1.png and /dev/null differ diff --git a/docs/reference/ggflexsurvplot.html b/docs/reference/ggflexsurvplot.html deleted file mode 100644 index 487d214..0000000 --- a/docs/reference/ggflexsurvplot.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - -Ggplots of Fitted Flexible Survival Models — ggflexsurvplot • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Create ggplot2-based graphs for flexible survival models.

    -
    - -
    ggflexsurvplot(
    -  fit,
    -  data = NULL,
    -  fun = c("survival", "cumhaz"),
    -  summary.flexsurv = NULL,
    -  size = 1,
    -  conf.int = FALSE,
    -  conf.int.flex = conf.int,
    -  conf.int.km = FALSE,
    -  legend.labs = NULL,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class flexsurvreg.

    data

    the data used to fit survival curves.

    fun

    the type of survival curves. Allowed values include "survival" -(default) and "cumhaz" (for cumulative hazard).

    summary.flexsurv

    (optional) the summary of the flexsurvreg -object as generated by the function summary().

    size

    line size for the flexible survival estimates.

    conf.int, conf.int.flex

    logical. If TRUE, add confidence bands for -flexible survival estimates.

    conf.int.km

    same as conf.in.flex but for the kaplan-meier -estimates.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    ...

    additional arguments passed to the function ggsurvplot().

    - -

    Value

    - -

    a ggsurvplot

    - -

    Examples

    -
    # \donttest{ -if(require("flexsurv")) { -fit <- flexsurvreg(Surv(rectime, censrec) ~ group, - dist = "gengamma", data = bc) -ggflexsurvplot(fit) -}
    #> Le chargement a nécessité le package : flexsurv
    # } - -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggforest-1.png b/docs/reference/ggforest-1.png deleted file mode 100644 index bbf0670..0000000 Binary files a/docs/reference/ggforest-1.png and /dev/null differ diff --git a/docs/reference/ggforest-2.png b/docs/reference/ggforest-2.png deleted file mode 100644 index 4d6ca54..0000000 Binary files a/docs/reference/ggforest-2.png and /dev/null differ diff --git a/docs/reference/ggforest.html b/docs/reference/ggforest.html deleted file mode 100644 index d1c2940..0000000 --- a/docs/reference/ggforest.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - -Forest Plot for Cox Proportional Hazards Model — ggforest • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Drawing Forest Plot for Cox proportional hazards model. In two panels the model structure is presented.

    -
    - -
    ggforest(
    -  model,
    -  data = NULL,
    -  main = "Hazard ratio",
    -  cpositions = c(0.02, 0.22, 0.4),
    -  fontsize = 0.7,
    -  refLabel = "reference",
    -  noDigits = 2
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    model

    an object of class coxph.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    main

    title of the plot.

    cpositions

    relative positions of first three columns in the OX scale.

    fontsize

    relative size of annotations in the plot. Default value: 0.7.

    refLabel

    label for reference levels of factor variables.

    noDigits

    number of digits for estimates and p-values in the plot.

    - -

    Value

    - -

    returns a ggplot2 object (invisibly)

    - -

    Examples

    -
    require("survival") -model <- coxph( Surv(time, status) ~ sex + rx + adhere, - data = colon ) -ggforest(model)
    #> Warning: The `data` argument is not provided. Data will be extracted from model fit.
    -colon <- within(colon, { - sex <- factor(sex, labels = c("female", "male")) - differ <- factor(differ, labels = c("well", "moderate", "poor")) - extent <- factor(extent, labels = c("submuc.", "muscle", "serosa", "contig.")) -}) -bigmodel <- - coxph(Surv(time, status) ~ sex + rx + adhere + differ + extent + node4, - data = colon ) -ggforest(bigmodel)
    #> Warning: The `data` argument is not provided. Data will be extracted from model fit.
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvevents-1.png b/docs/reference/ggsurvevents-1.png deleted file mode 100644 index ec0ff62..0000000 Binary files a/docs/reference/ggsurvevents-1.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-2.png b/docs/reference/ggsurvevents-2.png deleted file mode 100644 index 2280f4a..0000000 Binary files a/docs/reference/ggsurvevents-2.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-3.png b/docs/reference/ggsurvevents-3.png deleted file mode 100644 index 2280f4a..0000000 Binary files a/docs/reference/ggsurvevents-3.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-4.png b/docs/reference/ggsurvevents-4.png deleted file mode 100644 index ec0ff62..0000000 Binary files a/docs/reference/ggsurvevents-4.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-5.png b/docs/reference/ggsurvevents-5.png deleted file mode 100644 index 2280f4a..0000000 Binary files a/docs/reference/ggsurvevents-5.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-6.png b/docs/reference/ggsurvevents-6.png deleted file mode 100644 index 8cab0b9..0000000 Binary files a/docs/reference/ggsurvevents-6.png and /dev/null differ diff --git a/docs/reference/ggsurvevents-7.png b/docs/reference/ggsurvevents-7.png deleted file mode 100644 index 2280f4a..0000000 Binary files a/docs/reference/ggsurvevents-7.png and /dev/null differ diff --git a/docs/reference/ggsurvevents.html b/docs/reference/ggsurvevents.html deleted file mode 100644 index 0f03910..0000000 --- a/docs/reference/ggsurvevents.html +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - -Distribution of Events' Times — ggsurvevents • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Distribution of Events' Times

    -
    - -
    ggsurvevents(
    -  surv = NULL,
    -  fit = NULL,
    -  data = NULL,
    -  type = "fraction",
    -  normalized = TRUE,
    -  censored.on.top = TRUE,
    -  ggtheme = theme_survminer(),
    -  palette = c("grey75", "grey25"),
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    surv

    an object of Surv. If not suplied, the censoring variable is extracted from the model.

    fit

    an object of class survfit.

    data

    a dataset for predictions. If not supplied then data will be extracted from `fit` object.

    type

    one of c("cumulative", "radius", "fraction"). "cumulative" stands for cumulative number of events, "radius" stands for number of events within a given radius,

    normalized

    if TRUE relative number of events is presented,

    censored.on.top

    is TRUE then censored events are on the top

    ggtheme

    function, ggplot2 theme name. Allowed values include ggplot2 official themes: see theme.

    palette

    the color palette to be used for coloring of significant variables.

    ...

    other graphical parameters to be passed to the function ggpar.

    - -

    Value

    - -

    return an object of class ggplot

    - -

    Examples

    -
    require("survival") -# from Surv -surv <- Surv(lung$time, lung$status) -ggsurvevents(surv)
    -surv2 <- Surv(colon$time, colon$status) -ggsurvevents(surv2)
    ggsurvevents(surv2, normalized = TRUE)
    -# from survfit -fit <- survfit(Surv(time, status) ~ sex, data = lung) -ggsurvevents(fit = fit, data = lung)
    #> Warning: The `surv` argument is not provided. The censored variable will be extracted from model fit.
    -# from coxph -model <- coxph( Surv(time, status) ~ sex + rx + adhere, data = colon ) -ggsurvevents(fit = model, data = colon)
    #> Warning: The `surv` argument is not provided. The censored variable will be extracted from model fit.
    ggsurvevents(surv2, normalized = TRUE, type = "radius")
    ggsurvevents(surv2, normalized = TRUE, type = "fraction")
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot-1.png b/docs/reference/ggsurvplot-1.png deleted file mode 100644 index 37ee71a..0000000 Binary files a/docs/reference/ggsurvplot-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot-2.png b/docs/reference/ggsurvplot-2.png deleted file mode 100644 index 90e4beb..0000000 Binary files a/docs/reference/ggsurvplot-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot-3.png b/docs/reference/ggsurvplot-3.png deleted file mode 100644 index 6770f8c..0000000 Binary files a/docs/reference/ggsurvplot-3.png and /dev/null differ diff --git a/docs/reference/ggsurvplot-4.png b/docs/reference/ggsurvplot-4.png deleted file mode 100644 index 59134da..0000000 Binary files a/docs/reference/ggsurvplot-4.png and /dev/null differ diff --git a/docs/reference/ggsurvplot-5.png b/docs/reference/ggsurvplot-5.png deleted file mode 100644 index cf50a2c..0000000 Binary files a/docs/reference/ggsurvplot-5.png and /dev/null differ diff --git a/docs/reference/ggsurvplot.html b/docs/reference/ggsurvplot.html deleted file mode 100644 index e010710..0000000 --- a/docs/reference/ggsurvplot.html +++ /dev/null @@ -1,738 +0,0 @@ - - - - - - - - -Drawing Survival Curves Using ggplot2 — ggsurvplot • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    ggsurvplot() is a generic function to plot survival curves. Wrapper - around the ggsurvplot_xx() family functions. Plot one or a list of - survfit objects as generated by the - survfit.formula() and surv_fit functions:

    See the documentation for each function to - learn how to control that aspect of the ggsurvplot(). - ggsurvplot() accepts further arguments to be passed to the - ggsurvplot_xx() functions. Has options to:

      -
    • plot a list of survfit objects,

    • -
    • facet survival curves into multiple - panels,

    • -
    • group dataset by one or two grouping variables and to create - the survival curves in each subset,

    • -
    • combine multiple survfit - objects into one plot,

    • -
    • add survival curves of the pooled patients - (null model) onto the main stratified plot,

    • -
    • plot survival curves from - a data frame containing survival curve summary as returned by - surv_summary().

    • -
    - -
    - -
    ggsurvplot(
    -  fit,
    -  data = NULL,
    -  fun = NULL,
    -  color = NULL,
    -  palette = NULL,
    -  linetype = 1,
    -  conf.int = FALSE,
    -  pval = FALSE,
    -  pval.method = FALSE,
    -  test.for.trend = FALSE,
    -  surv.median.line = "none",
    -  risk.table = FALSE,
    -  cumevents = FALSE,
    -  cumcensor = FALSE,
    -  tables.height = 0.25,
    -  group.by = NULL,
    -  facet.by = NULL,
    -  add.all = FALSE,
    -  combine = FALSE,
    -  ggtheme = theme_survminer(),
    -  tables.theme = ggtheme,
    -  ...
    -)
    -
    -# S3 method for ggsurvplot
    -print(
    -  x,
    -  surv.plot.height = NULL,
    -  risk.table.height = NULL,
    -  ncensor.plot.height = NULL,
    -  newpage = TRUE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    allowed values include:

      -
    • a survfit object

    • -
    • a list of survfit objects. Passed to ggsurvplot_list()

    • -
    • a data frame containing survival curves summary. Passed to ggsurvplot_df().

    • -
    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    fun

    an arbitrary function defining a transformation of the survival -curve. Often used transformations can be specified with a character -argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the -cumulative hazard function (f(y) = -log(y)), and "pct" for survival -probability in percentage.

    color

    color to be used for the survival curves.

      -
    • 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. In this -case, it's possible to specify a custom color palette by using the argument -palette.

    • -
    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    linetype

    line types. Allowed values includes i) "strata" for changing -linetypes by strata (i.e. groups); ii) a numeric vector (e.g., c(1, 2)) or a -character vector c("solid", "dashed").

    conf.int

    logical value. If TRUE, plots confidence interval.

    pval

    logical value, a numeric or a string. If logical and TRUE, the -p-value is added on the plot. If numeric, than the computet p-value is -substituted with the one passed with this parameter. If character, then the -customized string appears on the plot. See examples - Example 3.

    pval.method

    whether to add a text with the test name used for -calculating the pvalue, that corresponds to survival curves' comparison - -used only when pval=TRUE

    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.

    surv.median.line

    character vector for drawing a horizontal/vertical -line at median survival. Allowed values include one of c("none", "hv", "h", -"v"). v: vertical, h:horizontal.

    risk.table

    Allowed values include:

      -
    • TRUE or FALSE -specifying whether to show or not the risk table. Default is FALSE.

    • -
    • "absolute" or "percentage". Shows the absolute number and the -percentage of subjects at risk by time, respectively.

    • -
    • "abs_pct" -to show both absolute number and percentage.

    • -
    • "nrisk_cumcensor" and -"nrisk_cumevents". Show the number at risk and, the cumulative number of -censoring and events, respectively.

    • -
    cumevents

    logical value specifying whether to show or not the table of -the cumulative number of events. Default is FALSE.

    cumcensor

    logical value specifying whether to show or not the table of -the cumulative number of censoring. Default is FALSE.

    tables.height

    numeric value (in [0 - 1]) specifying the general height -of all tables under the main survival plot.

    group.by

    a character vector containing the name of grouping variables. Should be of length <= 2. -Alias of the ggsurvplot_group_by() function.

    facet.by

    a character vector containing the name of grouping variables -to facet the survival curves into multiple panels. Should be of length <= 2. -Alias of the ggsurvplot_facet() function.

    add.all

    a logical value. If TRUE, add the survival curve of pooled patients (null model) onto the main plot. -Alias of the ggsurvplot_add_all() function.

    combine

    a logical value. If TRUE, combine a list survfit objects on the same plot. -Alias of the ggsurvplot_combine() function.

    ggtheme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme.

    tables.theme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme. Note that, tables.theme is incremental to ggtheme.

    ...

    Futher arguments as described hereafter and -other arguments to be passed i) to ggplot2 geom_*() functions such - as linetype, size, ii) or to the function ggpar() for - customizing the plots. See details section.

    x

    an object of class ggsurvplot

    surv.plot.height

    the height of the survival plot on the grid. Default -is 0.75. Ignored when risk.table = FALSE.

    risk.table.height

    the height of the risk table on the grid. Increase -the value when you have many strata. Default is 0.25. Ignored when -risk.table = FALSE.

    ncensor.plot.height

    The height of the censor plot. Used when -ncensor.plot = TRUE.

    newpage

    open a new page. See grid.arrange

    - -

    Value

    - -

    return an object of class ggsurvplot which is list containing the - following components:

      -
    • plot: the survival plot (ggplot - object)

    • -
    • table: the number of subjects at risk table per time (ggplot - object).

    • -
    • cumevents: the cumulative number of events table (ggplot - object).

    • -
    • ncensor.plot: the number of censoring (ggplot object).

    • -
    • data.survplot: the data used to plot the survival curves (data.frame).

    • -
    • data.survtable: the data used to plot the tables under the main survival - curves (data.frame).

    • -
    - -

    Details

    - - -
      -
    • Color palettes: The argument palette can be used to - specify the color to be used for each group. By default, the first color in - the palette is used to color the first level of the factor variable. This - default behavior can be changed by assigning correctly a named vector. That - is, the names of colors should match the strata names as generated by the - ggsurvplot() function in the legend.

    • -
    - -

    FURTHER ARGUMENTS

    - - - -

    Customize survival plots and tables. See also ggsurvplot_arguments.

    -

    Plot title and axis labels

    - - - -
      -
    • title: main title.

    • -
    • xlab, ylab: x and y axis labels, respectively.

    • -
    - -

    Legend title, labels and position

    - - - -
      -
    • legend: character specifying legend position. Allowed values are one of - c("top", "bottom", "left", "right", "none"). Default is "top" side position. - to remove the legend use legend = "none". Legend position can be also - specified using a numeric vector c(x, y). In this case it is - possible to position the legend inside the plotting area. x and y are the - coordinates of the legend box. Their values should be between 0 and 1. - c(0,0) corresponds to the "bottom left" and c(1,1) corresponds to the "top - right" position. For instance use legend = c(0.8, 0.2).

    • -
    • legend.title: legend title.

    • -
    • legend.labs: character vector specifying legend labels. Used to replace - the names of the strata from the fit. Should be given in the same order as - those strata.

    • -
    - -

    Axis limits, breaks and scales

    - - - -
      -
    • break.time.by: numeric value controlling time axis breaks. Default value - is NULL.

    • -
    • break.x.by: alias of break.time.by. Numeric value controlling x axis - breaks. Default value is NULL.

    • -
    • break.y.by: same as break.x.by but for y axis.

    • -
    • surv.scale: scale transformation of survival curves. Allowed values are - "default" or "percent".

    • -
    • xscale: 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 - "d_m", "d_y", - "m_d", "m_y", "y_d" and "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.

      • -
    • -
    • xlim,ylim: x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    • -
    • axes.offset: logical value. Default is TRUE. If FALSE, set the plot axes to start at the origin.

    • -
    - -

    Confidence interval

    - - - -
      -
    • conf.int.fill: fill color to be used for confidence interval.

    • -
    • conf.int.style: confidence interval style. Allowed values include c("ribbon", "step").

    • -
    • conf.int.alpha: numeric value specifying confidence fill color transparency. - Value should be in [0, 1], where 0 is full transparency and 1 is no transparency.

    • -
    - -

    P-value

    - - - -
      -
    • pval.size: numeric value specifying the p-value text size. Default is 5.

    • -
    • pval.coord: numeric vector, of length 2, - specifying the x and y coordinates of the p-value. - Default values are NULL.

    • -
    • pval.method.size: the same as pval.size but for displaying - log.rank.weights name.

    • -
    • pval.method.coord: the same as pval.coord but for displaying - log.rank.weights name.

    • -
    • log.rank.weights: the name for the type of weights to be used in - computing the p-value for log-rank test. By default survdiff is used - to calculate regular log-rank test (with weights == 1). A user can specify - "1", "n", "sqrtN", "S1", "S2", "FH" to use weights specified in - comp, so that weight correspond to the test as : 1 - - log-rank, n - Gehan-Breslow (generalized Wilcoxon), sqrtN - Tarone-Ware, S1 - - Peto-Peto's modified survival estimate, S2 - modified Peto-Peto (by - Andersen), FH - Fleming-Harrington(p=1, q=1).

    • -
    - -

    Median survival

    - - - -
      -
    • surv.median.line: character vector for drawing a - horizontal/vertical line at median survival. - Allowed values include one of c("none", "hv", "h", "v"). v: vertical, h:horizontal.

    • -
    - -

    Censor points

    - - - -
      -
    • censor: logical value. If TRUE (default), censors will be drawn.

    • -
    • censor.shape: character or numeric value specifying the point shape of censors. - Default value is "+" (3), a sensible choice is "|" (124).

    • -
    • censor.size: numveric value specifying the point size of censors. Default is 4.5.

    • -
    - -

    Survival tables

    - - - - -

    General parameters for all tables. - The arguments below, when specified, will be applied to all survival tables at once - (risk, cumulative events and cumulative censoring tables).

      -
    • tables.col: color to be used for all tables under the main plot. Default - value is "black". If you want to color by strata (i.e. groups), use - tables.col = "strata".

    • -
    • fontsize: font size to be used for the risk table - and the cumulative events table.

    • -
    • font.family: character vector specifying text element font family, - e.g.: font.family = "Courier New".

    • -
    • tables.y.text: logical. Default is TRUE. If FALSE, the y axis tick - labels of tables will be hidden.

    • -
    • tables.y.text.col: logical. Default value is FALSE. If TRUE, the y - tick labels of tables will be colored by strata.

    • -
    • tables.height: numeric value (in [0 - 1]) specifying the general height - of all tables under the main survival plot. - Increase the value when you have many strata. Default is 0.25.

    • -
    - -

    Specific to the risk table

      -
    • risk.table.title: the title to be used for the risk table.

    • -
    • risk.table.pos: character vector specifying the risk table position. - Allowed options are one of c("out", "in") indicating 'outside' or 'inside' - the main plot, respectively. Default value is "out".

    • -
    • risk.table.col, risk.table.fontsize, risk.table.y.text, - risk.table.y.text.col and risk.table.height: same as for the general parameters - but applied to the risk table only.

    • -
    - -

    Specific to the number of cumulative events table (cumevents)

      -
    • cumevents.title: the title to be used for the cumulative events table.

    • -
    • cumevents.col, cumevents.y.text, cumevents.y.text, cumevents.height: - same as for the general parameters but for the cumevents table only.

    • -
    - -

    Specific to the number of cumulative censoring table (cumcensor)

      -
    • cumcensor.title: the title to be used for the cumcensor table.

    • -
    • cumcensor.col, cumcensor.y.text, cumcensor.y.text.col, cumcensor.height: - same as for the general parameters but for cumcensor table only.

    • -
    - -

    Survival plot height

    - - - -
      -
    • surv.plot.height: the height of the survival plot on the grid. Default - is 0.75. Ignored when risk.table = FALSE.

    • -
    - -

    Number of censored subjects barplot

    - - - -
      -
    • ncensor.plot: logical value. If TRUE, the number of censored subjects at - time t is plotted. Default is FALSE. Ignored when cumcensor = TRUE.

    • -
    • ncensor.plot.title: the title to be used for the censor plot. Used when - ncensor.plot = TRUE.

    • -
    • ncensor.plot.height: the height of the censor plot. Used when - ncensor.plot = TRUE.

    • -
    - -

    Other graphical parameters

    - - - -

    The plot can be easily customized using additional arguments to be - passed to the function ggpar().

    -

    These arguments include - font.title, font.subtitle, font.caption, font.x, font.y, font.tickslab and font.legend, - which are vectors of length 3 indicating respectively the size - (e.g.: 14), the style (e.g.: "plain", "bold", "italic", "bold.italic") and - the color (e.g.: "red") of main title, subtitle, caption, xlab and ylab, - axis tick labels and legend, respectively. For example font.x = c(14, - "bold", "red").

    -

    Use font.x = 14, to change only font size; or use font.x = - "bold", to change only font face.

    - -

    Examples

    -
    -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# Example 1: Survival curves with two groups -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -# Fit survival curves -#++++++++++++++++++++++++++++++++++++ -require("survival") -fit<- survfit(Surv(time, status) ~ sex, data = lung) - -# Basic survival curves -ggsurvplot(fit, data = lung)
    -# Customized survival curves -ggsurvplot(fit, data = lung, - surv.median.line = "hv", # Add medians survival - - # Change legends: title & labels - legend.title = "Sex", - legend.labs = c("Male", "Female"), - # Add p-value and tervals - pval = TRUE, - - conf.int = TRUE, - # Add risk table - risk.table = TRUE, - tables.height = 0.2, - tables.theme = theme_cleantable(), - - # Color palettes. Use custom color: c("#E7B800", "#2E9FDF"), - # or brewer color (e.g.: "Dark2"), or ggsci color (e.g.: "jco") - palette = c("#E7B800", "#2E9FDF"), - ggtheme = theme_bw() # Change ggplot2 theme -)
    -# Change font size, style and color -#++++++++++++++++++++++++++++++++++++ -if (FALSE) { -# Change font size, style and color at the same time -ggsurvplot(fit, data = lung, main = "Survival curve", - font.main = c(16, "bold", "darkblue"), - font.x = c(14, "bold.italic", "red"), - font.y = c(14, "bold.italic", "darkred"), - font.tickslab = c(12, "plain", "darkgreen")) -} - - - -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# Example 2: Facet ggsurvplot() output by -# a combination of factors -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -# Fit (complexe) survival curves -#++++++++++++++++++++++++++++++++++++ -if (FALSE) { -require("survival") -fit3 <- survfit( Surv(time, status) ~ sex + rx + adhere, - data = colon ) - -# Visualize -#++++++++++++++++++++++++++++++++++++ -ggsurv <- ggsurvplot(fit3, data = colon, - fun = "cumhaz", conf.int = TRUE, - risk.table = TRUE, risk.table.col="strata", - ggtheme = theme_bw()) - -# Faceting survival curves -curv_facet <- ggsurv$plot + facet_grid(rx ~ adhere) -curv_facet - -# Faceting risk tables: -# Generate risk table for each facet plot item -ggsurv$table + facet_grid(rx ~ adhere, scales = "free")+ - theme(legend.position = "none") - - # Generate risk table for each facet columns -tbl_facet <- ggsurv$table + facet_grid(.~ adhere, scales = "free") -tbl_facet + theme(legend.position = "none") - -# Arrange faceted survival curves and risk tables -g2 <- ggplotGrob(curv_facet) -g3 <- ggplotGrob(tbl_facet) -min_ncol <- min(ncol(g2), ncol(g3)) -g <- gridExtra::gtable_rbind(g2[, 1:min_ncol], g3[, 1:min_ncol], size="last") -g$widths <- grid::unit.pmax(g2$widths, g3$widths) -grid::grid.newpage() -grid::grid.draw(g) - -} - -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# Example 3: CUSTOMIZED PVALUE -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# Customized p-value -ggsurvplot(fit, data = lung, pval = TRUE)
    ggsurvplot(fit, data = lung, pval = 0.03)
    ggsurvplot(fit, data = lung, pval = "The hot p-value is: 0.031")
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_add_all-1.png b/docs/reference/ggsurvplot_add_all-1.png deleted file mode 100644 index b5c7e12..0000000 Binary files a/docs/reference/ggsurvplot_add_all-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_add_all-2.png b/docs/reference/ggsurvplot_add_all-2.png deleted file mode 100644 index 65d4464..0000000 Binary files a/docs/reference/ggsurvplot_add_all-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_add_all.html b/docs/reference/ggsurvplot_add_all.html deleted file mode 100644 index 610a9ea..0000000 --- a/docs/reference/ggsurvplot_add_all.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - -Add Survival Curves of Pooled Patients onto the Main Plot — ggsurvplot_add_all • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Add survival curves of pooled patients onto the main plot stratified by grouping variables.

    -
    - -
    ggsurvplot_add_all(
    -  fit,
    -  data,
    -  legend.title = "Strata",
    -  legend.labs = NULL,
    -  pval = FALSE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class survfit.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    legend.title

    legend title.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    pval

    logical value, a numeric or a string. If logical and TRUE, the -p-value is added on the plot. If numeric, than the computet p-value is -substituted with the one passed with this parameter. If character, then the -customized string appears on the plot. See examples - Example 3.

    ...

    other arguments passed to the ggsurvplot() function.

    - -

    Value

    - -

    Return a ggsurvplot.

    -

    See also

    - - - -

    Examples

    -
    library(survival) - -# Fit survival curves -fit <- surv_fit(Surv(time, status) ~ sex, data = lung) - -# Visualize survival curves -ggsurvplot(fit, data = lung, - risk.table = TRUE, pval = TRUE, - surv.median.line = "hv", palette = "jco")
    -# Add survival curves of pooled patients (Null model) -# Use add.all = TRUE option -ggsurvplot(fit, data = lung, - risk.table = TRUE, pval = TRUE, - surv.median.line = "hv", palette = "jco", - add.all = TRUE)
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_arguments.html b/docs/reference/ggsurvplot_arguments.html deleted file mode 100644 index e37be07..0000000 --- a/docs/reference/ggsurvplot_arguments.html +++ /dev/null @@ -1,512 +0,0 @@ - - - - - - - - -ggsurvplot Argument Descriptions — ggsurvplot_arguments • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    ggsurvplot Argument Descriptions

    -
    - - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class survfit.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    fun

    an arbitrary function defining a transformation of the survival -curve. Often used transformations can be specified with a character -argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the -cumulative hazard function (f(y) = -log(y)), and "pct" for survival -probability in percentage.

    surv.scale

    scale transformation of survival curves. Allowed values are -"default" or "percent".

    xscale

    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.

    • -
    color

    color to be used for the survival curves.

      -
    • 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. In this -case, it's possible to specify a custom color palette by using the argument -palette.

    • -
    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    linetype

    line types. Allowed values includes i) "strata" for changing -linetypes by strata (i.e. groups); ii) a numeric vector (e.g., c(1, 2)) or a -character vector c("solid", "dashed").

    break.time.by

    numeric value controlling time axis breaks. Default value -is NULL.

    break.x.by

    alias of break.time.by. Numeric value controlling x axis -breaks. Default value is NULL.

    break.y.by

    same as break.x.by but for y axis.

    conf.int

    logical value. If TRUE, plots confidence interval.

    conf.int.fill

    fill color to be used for confidence interval.

    conf.int.style

    confidence interval style. Allowed values include -c("ribbon", "step").

    conf.int.alpha

    numeric value specifying fill color transparency. Value -should be in [0, 1], where 0 is full transparency and 1 is no transparency.

    censor

    logical value. If TRUE, censors will be drawn.

    censor.shape

    character or numeric value specifying the point shape of -censors. Default value is "+" (3), a sensible choice is "|" (124).

    censor.size

    numveric value specifying the point size of censors. -Default is 4.5.

    pval

    logical value, a numeric or a string. If logical and TRUE, the -p-value is added on the plot. If numeric, than the computet p-value is -substituted with the one passed with this parameter. If character, then the -customized string appears on the plot. See examples - Example 3.

    pval.size

    numeric value specifying the p-value text size. Default is 5.

    pval.coord

    numeric vector, of length 2, specifying the x and y -coordinates of the p-value. Default values are NULL.

    title, xlab, ylab

    main title and axis labels

    xlim, ylim

    x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    axes.offset

    logical value. Default is TRUE. If FALSE, set the plot axes -to start at the origin.

    legend

    character specifying legend position. Allowed values are one of -c("top", "bottom", "left", "right", "none"). Default is "top" side position. -to remove the legend use legend = "none". Legend position can be also -specified using a numeric vector c(x, y); see details section.

    legend.title

    legend title.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    risk.table

    Allowed values include:

      -
    • TRUE or FALSE -specifying whether to show or not the risk table. Default is FALSE.

    • -
    • "absolute" or "percentage". Shows the absolute number and the -percentage of subjects at risk by time, respectively.

    • -
    • "abs_pct" -to show both absolute number and percentage.

    • -
    • "nrisk_cumcensor" and -"nrisk_cumevents". Show the number at risk and, the cumulative number of -censoring and events, respectively.

    • -
    risk.table.title

    The title to be used for the risk table.

    risk.table.pos

    character vector specifying the risk table position. -Allowed options are one of c("out", "in") indicating 'outside' or 'inside' -the main plot, respectively. Default value is "out".

    risk.table.col

    same as tables.col but for risk table only.

    risk.table.fontsize, fontsize

    font size to be used for the risk table -and the cumulative events table.

    risk.table.y.text

    logical. Default is TRUE. If FALSE, risk table y axis -tick labels will be hidden.

    risk.table.y.text.col

    logical. Default value is FALSE. If TRUE, risk -table tick labels will be colored by strata.

    tables.height

    numeric value (in [0 - 1]) specifying the general height -of all tables under the main survival plot.

    tables.y.text

    logical. Default is TRUE. If FALSE, the y axis tick -labels of tables will be hidden.

    tables.y.text.col

    logical. Default value is FALSE. If TRUE, tables tick -labels will be colored by strata.

    tables.col

    color to be used for all tables under the main plot. Default -value is "black". If you want to color by strata (i.e. groups), use -tables.col = "strata".

    tables.theme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme. Note that, tables.theme is incremental to ggtheme.

    risk.table.height

    the height of the risk table on the grid. Increase -the value when you have many strata. Default is 0.25. Ignored when -risk.table = FALSE.

    surv.plot.height

    the height of the survival plot on the grid. Default -is 0.75. Ignored when risk.table = FALSE.

    ncensor.plot

    logical value. If TRUE, the number of censored subjects at -time t is plotted. Default is FALSE. Ignored when cumcensor = TRUE.

    ncensor.plot.title

    The title to be used for the censor plot. Used when -ncensor.plot = TRUE.

    ncensor.plot.height

    The height of the censor plot. Used when -ncensor.plot = TRUE.

    cumevents

    logical value specifying whether to show or not the table of -the cumulative number of events. Default is FALSE.

    cumevents.title

    The title to be used for the cumulative events table.

    cumevents.col

    same as tables.col but for the cumulative events table -only.

    cumevents.y.text

    logical. Default is TRUE. If FALSE, the y axis tick -labels of the cumulative events table will be hidden.

    cumevents.y.text.col

    logical. Default value is FALSE. If TRUE, the y -tick labels of the cumulative events will be colored by strata.

    cumevents.height

    the height of the cumulative events table on the grid. -Default is 0.25. Ignored when cumevents = FALSE.

    cumcensor

    logical value specifying whether to show or not the table of -the cumulative number of censoring. Default is FALSE.

    cumcensor.title

    The title to be used for the cumcensor table.

    cumcensor.col

    same as tables.col but for cumcensor table only.

    cumcensor.y.text

    logical. Default is TRUE. If FALSE, the y axis tick -labels of the cumcensor table will be hidden.

    cumcensor.y.text.col

    logical. Default value is FALSE. If TRUE, the y -tick labels of the cumcensor will be colored by strata.

    cumcensor.height

    the height of the cumcensor table on the grid. Default -is 0.25. Ignored when cumcensor = FALSE.

    surv.median.line

    character vector for drawing a horizontal/vertical -line at median survival. Allowed values include one of c("none", "hv", "h", -"v"). v: vertical, h:horizontal.

    ggtheme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme.

    ...

    other arguments to be passed i) to ggplot2 geom_*() functions such -as linetype, size, ii) or to the function ggpar() for -customizing the plots. See details section.

    log.rank.weights

    The name for the type of weights to be used in -computing the p-value for log-rank test. By default survdiff is used -to calculate regular log-rank test (with weights == 1). A user can specify -"1", "n", "sqrtN", "S1", "S2", "FH" to use weights specified in -comp, so that weight correspond to the test as : 1 - -log-rank, n - Gehan-Breslow (generalized Wilcoxon), sqrtN - Tarone-Ware, S1 -- Peto-Peto's modified survival estimate, S2 - modified Peto-Peto (by -Andersen), FH - Fleming-Harrington(p=1, q=1).

    pval.method

    whether to add a text with the test name used for -calculating the pvalue, that corresponds to survival curves' comparison - -used only when pval=TRUE

    pval.method.size

    the same as pval.size but for displaying -log.rank.weights name

    pval.method.coord

    the same as pval.coord but for displaying -log.rank.weights name

    - - -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_combine-1.png b/docs/reference/ggsurvplot_combine-1.png deleted file mode 100644 index 590ee8f..0000000 Binary files a/docs/reference/ggsurvplot_combine-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_combine-2.png b/docs/reference/ggsurvplot_combine-2.png deleted file mode 100644 index dfd7e7a..0000000 Binary files a/docs/reference/ggsurvplot_combine-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_combine.html b/docs/reference/ggsurvplot_combine.html deleted file mode 100644 index cd05bd3..0000000 --- a/docs/reference/ggsurvplot_combine.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - -Combine a List of Survfit Objects on the Same Plot — ggsurvplot_combine • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Combine multiple survfit objects on the same plot. For example, - one might wish to plot progression free survival and overall survival on - the same graph (and also stratified by treatment assignment). - ggsurvplot_combine() provides an extension to the - ggsurvplot() function for doing that.

    -
    - -
    ggsurvplot_combine(
    -  fit,
    -  data,
    -  risk.table = FALSE,
    -  risk.table.pos = c("out", "in"),
    -  cumevents = FALSE,
    -  cumcensor = FALSE,
    -  tables.col = "black",
    -  tables.y.text = TRUE,
    -  tables.y.text.col = TRUE,
    -  ggtheme = theme_survminer(),
    -  tables.theme = ggtheme,
    -  keep.data = FALSE,
    -  risk.table.y.text = tables.y.text,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    a named list of survfit objects.

    data

    the data frame used to compute survival curves.

    risk.table

    Allowed values include:

      -
    • TRUE or FALSE -specifying whether to show or not the risk table. Default is FALSE.

    • -
    • "absolute" or "percentage". Shows the absolute number and the -percentage of subjects at risk by time, respectively.

    • -
    • "abs_pct" -to show both absolute number and percentage.

    • -
    • "nrisk_cumcensor" and -"nrisk_cumevents". Show the number at risk and, the cumulative number of -censoring and events, respectively.

    • -
    risk.table.pos

    character vector specifying the risk table position. -Allowed options are one of c("out", "in") indicating 'outside' or 'inside' -the main plot, respectively. Default value is "out".

    cumevents

    logical value specifying whether to show or not the table of -the cumulative number of events. Default is FALSE.

    cumcensor

    logical value specifying whether to show or not the table of -the cumulative number of censoring. Default is FALSE.

    tables.col

    color to be used for all tables under the main plot. Default -value is "black". If you want to color by strata (i.e. groups), use -tables.col = "strata".

    tables.y.text

    logical. Default is TRUE. If FALSE, the y axis tick -labels of tables will be hidden.

    tables.y.text.col

    logical. Default value is FALSE. If TRUE, tables tick -labels will be colored by strata.

    ggtheme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme.

    tables.theme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme. Note that, tables.theme is incremental to ggtheme.

    keep.data

    logical value specifying whether the plot data frame should be kept in the result. -Setting these to FALSE (default) can give much smaller results and hence even save memory allocation time.

    risk.table.y.text

    logical. Default is TRUE. If FALSE, risk table y axis -tick labels will be hidden.

    ...

    other arguments to pass to the ggsurvplot() function.

    - - -

    Examples

    -
    library(survival) -# Create a demo data set -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: - set.seed(123) - demo.data <- data.frame( - os.time = colon$time, - os.status = colon$status, - pfs.time = sample(colon$time), - pfs.status = colon$status, - sex = colon$sex, rx = colon$rx, adhere = colon$adhere - ) - -# Ex1: Combine null models -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: - # Fit - pfs <- survfit( Surv(pfs.time, pfs.status) ~ 1, data = demo.data) - os <- survfit( Surv(os.time, os.status) ~ 1, data = demo.data) - # Combine on the same plot - fit <- list(PFS = pfs, OS = os) - ggsurvplot_combine(fit, demo.data)
    #> Warning: `select_()` is deprecated as of dplyr 0.7.0. -#> Please use `select()` instead. -#> This warning is displayed once every 8 hours. -#> Call `lifecycle::last_warnings()` to see where this warning was generated.
    -# Combine survival curves stratified by treatment assignment rx -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -# Fit -pfs <- survfit( Surv(pfs.time, pfs.status) ~ rx, data = demo.data) -os <- survfit( Surv(os.time, os.status) ~ rx, data = demo.data) -# Combine on the same plot -fit <- list(PFS = pfs, OS = os) -ggsurvplot_combine(fit, demo.data)
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_df-1.png b/docs/reference/ggsurvplot_df-1.png deleted file mode 100644 index be9c9fa..0000000 Binary files a/docs/reference/ggsurvplot_df-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_df-2.png b/docs/reference/ggsurvplot_df-2.png deleted file mode 100644 index a821b6f..0000000 Binary files a/docs/reference/ggsurvplot_df-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_df-3.png b/docs/reference/ggsurvplot_df-3.png deleted file mode 100644 index 7fe1ec7..0000000 Binary files a/docs/reference/ggsurvplot_df-3.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_df-4.png b/docs/reference/ggsurvplot_df-4.png deleted file mode 100644 index e2ffb8c..0000000 Binary files a/docs/reference/ggsurvplot_df-4.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_df-5.png b/docs/reference/ggsurvplot_df-5.png deleted file mode 100644 index 2beb19c..0000000 Binary files a/docs/reference/ggsurvplot_df-5.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_df.html b/docs/reference/ggsurvplot_df.html deleted file mode 100644 index 2e4d9be..0000000 --- a/docs/reference/ggsurvplot_df.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - -Plot Survival Curves from Survival Summary Data Frame — ggsurvplot_df • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    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.

    -
    - -
    ggsurvplot_df(
    -  fit,
    -  fun = NULL,
    -  color = NULL,
    -  palette = NULL,
    -  linetype = 1,
    -  break.x.by = NULL,
    -  break.time.by = NULL,
    -  break.y.by = NULL,
    -  surv.scale = c("default", "percent"),
    -  surv.geom = geom_step,
    -  xscale = 1,
    -  conf.int = FALSE,
    -  conf.int.fill = "gray",
    -  conf.int.style = "ribbon",
    -  conf.int.alpha = 0.3,
    -  censor = TRUE,
    -  censor.shape = "+",
    -  censor.size = 4.5,
    -  title = NULL,
    -  xlab = "Time",
    -  ylab = "Survival probability",
    -  xlim = NULL,
    -  ylim = NULL,
    -  axes.offset = TRUE,
    -  legend = c("top", "bottom", "left", "right", "none"),
    -  legend.title = "Strata",
    -  legend.labs = NULL,
    -  ggtheme = theme_survminer(),
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    a data frame as returned by surv_summary. Should contains at least -the following columns:

      -
    • time: survival time

    • -
    • surv: -survival probability

    • -
    • strata: grouping variables

    • -
    • n.censor: number -of censors

    • -
    • upper: upper end of confidence interval

    • -
    • lower: lower -end of confidence interval

    • -
    fun

    an arbitrary function defining a transformation of the survival -curve. Often used transformations can be specified with a character -argument: "event" plots cumulative events (f(y) = 1-y), "cumhaz" plots the -cumulative hazard function (f(y) = -log(y)), and "pct" for survival -probability in percentage.

    color

    color to be used for the survival curves.

      -
    • 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. In this -case, it's possible to specify a custom color palette by using the argument -palette.

    • -
    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    linetype

    line types. Allowed values includes i) "strata" for changing -linetypes by strata (i.e. groups); ii) a numeric vector (e.g., c(1, 2)) or a -character vector c("solid", "dashed").

    break.x.by

    alias of break.time.by. Numeric value controlling x axis -breaks. Default value is NULL.

    break.time.by

    numeric value controlling time axis breaks. Default value -is NULL.

    break.y.by

    same as break.x.by but for y axis.

    surv.scale

    scale transformation of survival curves. Allowed values are -"default" or "percent".

    surv.geom

    survival curve style. Is the survival curve entered a step -function (geom_step) or a smooth function (geom_line).

    xscale

    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.

    • -
    conf.int

    logical value. If TRUE, plots confidence interval.

    conf.int.fill

    fill color to be used for confidence interval.

    conf.int.style

    confidence interval style. Allowed values include -c("ribbon", "step").

    conf.int.alpha

    numeric value specifying fill color transparency. Value -should be in [0, 1], where 0 is full transparency and 1 is no transparency.

    censor

    logical value. If TRUE, censors will be drawn.

    censor.shape

    character or numeric value specifying the point shape of -censors. Default value is "+" (3), a sensible choice is "|" (124).

    censor.size

    numveric value specifying the point size of censors. -Default is 4.5.

    title

    main title and axis labels

    xlab

    main title and axis labels

    ylab

    main title and axis labels

    xlim

    x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    ylim

    x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    axes.offset

    logical value. Default is TRUE. If FALSE, set the plot axes -to start at the origin.

    legend

    character specifying legend position. Allowed values are one of -c("top", "bottom", "left", "right", "none"). Default is "top" side position. -to remove the legend use legend = "none". Legend position can be also -specified using a numeric vector c(x, y); see details section.

    legend.title

    legend title.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    ggtheme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme.

    ...

    other arguments to be passed i) to ggplot2 geom_*() functions such -as linetype, size, ii) or to the function ggpar() for -customizing the plots. See details section.

    - - -

    Examples

    -
    library(survival) - -# Fit survival curves -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit1 <- survfit( Surv(time, status) ~ 1, data = colon) -fit2 <- survfit( Surv(time, status) ~ adhere, data = colon) - -# Summary -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -head(surv_summary(fit1, colon))
    #> time n.risk n.event n.censor surv std.err upper lower -#> 1 8 1858 1 0 0.9994618 0.0005383580 1.0000000 0.9984077 -#> 2 9 1857 1 0 0.9989236 0.0007615583 1.0000000 0.9974337 -#> 3 19 1856 1 0 0.9983854 0.0009329660 1.0000000 0.9965614 -#> 4 20 1855 1 0 0.9978471 0.0010775868 0.9999569 0.9957419 -#> 5 23 1854 1 1 0.9973089 0.0012051037 0.9996673 0.9949561 -#> 6 24 1852 1 1 0.9967704 0.0013206006 0.9993537 0.9941938
    -head(surv_summary(fit2, colon))
    #> time n.risk n.event n.censor surv std.err upper lower -#> 1 8 1588 1 0 0.9993703 0.0006299213 1.0000000 0.9981372 -#> 2 9 1587 1 0 0.9987406 0.0008911240 1.0000000 0.9969977 -#> 3 19 1586 1 0 0.9981108 0.0010917438 1.0000000 0.9959774 -#> 4 20 1585 1 0 0.9974811 0.0012610351 0.9999495 0.9950188 -#> 5 23 1584 1 1 0.9968514 0.0014103253 0.9996107 0.9940997 -#> 6 24 1582 1 1 0.9962213 0.0015455856 0.9992437 0.9932080 -#> strata adhere -#> 1 adhere=0 0 -#> 2 adhere=0 0 -#> 3 adhere=0 0 -#> 4 adhere=0 0 -#> 5 adhere=0 0 -#> 6 adhere=0 0
    -# Visualize -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -ggsurvplot_df(surv_summary(fit1, colon))
    -ggsurvplot_df(surv_summary(fit2, colon), conf.int = TRUE, - legend.title = "Adhere", legend.labs = c("0", "1"))
    -# Kaplan-Meier estimate -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -out_km <- survfit(Surv(time, status) ~ 1, data = lung) - -# Weibull model -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -wb <- survreg(Surv(time, status) ~ 1, data = lung) -s <- seq(.01, .99, by = .01) -t <- predict(wb, type = "quantile", p = s, newdata = lung[1, ]) -out_wb <- data.frame(time = t, surv = 1 - s, upper = NA, lower = NA, std.err = NA) - -# plot both -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -p_km <- ggsurvplot(out_km, conf.int = FALSE) -p_wb <- ggsurvplot(out_wb, conf.int = FALSE, surv.geom = geom_line) - -p_km
    p_wb
    p_km$plot + geom_line(data = out_wb, aes(x = time, y = surv))
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_facet-1.png b/docs/reference/ggsurvplot_facet-1.png deleted file mode 100644 index cccc6c9..0000000 Binary files a/docs/reference/ggsurvplot_facet-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_facet-2.png b/docs/reference/ggsurvplot_facet-2.png deleted file mode 100644 index e0c6b0c..0000000 Binary files a/docs/reference/ggsurvplot_facet-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_facet-3.png b/docs/reference/ggsurvplot_facet-3.png deleted file mode 100644 index 31ed8aa..0000000 Binary files a/docs/reference/ggsurvplot_facet-3.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_facet.html b/docs/reference/ggsurvplot_facet.html deleted file mode 100644 index afde816..0000000 --- a/docs/reference/ggsurvplot_facet.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - -Facet Survival Curves into Multiple Panels — ggsurvplot_facet • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Draw multi-panel survival curves of a data set grouped by one or - two variables.

    -
    - -
    ggsurvplot_facet(
    -  fit,
    -  data,
    -  facet.by,
    -  color = NULL,
    -  palette = NULL,
    -  legend.labs = NULL,
    -  pval = FALSE,
    -  pval.method = FALSE,
    -  pval.coord = NULL,
    -  pval.method.coord = NULL,
    -  nrow = NULL,
    -  ncol = NULL,
    -  scales = "fixed",
    -  short.panel.labs = FALSE,
    -  panel.labs = NULL,
    -  panel.labs.background = list(color = NULL, fill = NULL),
    -  panel.labs.font = list(face = NULL, color = NULL, size = NULL, angle = NULL),
    -  panel.labs.font.x = panel.labs.font,
    -  panel.labs.font.y = panel.labs.font,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class survfit.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    facet.by

    character vector, of length 1 or 2, specifying grouping -variables for faceting the plot. Should be in the data.

    color

    color to be used for the survival curves.

      -
    • 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. In this -case, it's possible to specify a custom color palette by using the argument -palette.

    • -
    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    pval

    logical value, a numeric or a string. If logical and TRUE, the -p-value is added on the plot. If numeric, than the computet p-value is -substituted with the one passed with this parameter. If character, then the -customized string appears on the plot. See examples - Example 3.

    pval.method

    whether to add a text with the test name used for -calculating the pvalue, that corresponds to survival curves' comparison - -used only when pval=TRUE

    pval.coord

    numeric vector, of length 2, specifying the x and y -coordinates of the p-value. Default values are NULL.

    pval.method.coord

    the same as pval.coord but for displaying -log.rank.weights name

    nrow, ncol

    Number of rows and columns in the pannel. Used only when the -data is faceted by one grouping variable.

    scales

    should axis scales of panels be fixed ("fixed", the default), -free ("free"), or free in one dimension ("free_x", "free_y").

    short.panel.labs

    logical value. Default is FALSE. If TRUE, create short -labels for panels by omitting variable names; in other words panels will be -labelled only by variable grouping levels.

    panel.labs

    a list of one or two character vectors to modify facet label -text. For example, panel.labs = list(sex = c("Male", "Female")) specifies -the labels for the "sex" variable. For two grouping variables, you can use -for example panel.labs = list(sex = c("Male", "Female"), rx = c("Obs", -"Lev", "Lev2") ).

    panel.labs.background

    a list to customize the background of panel -labels. Should contain the combination of the following elements:

      -
    • color, linetype, size: background line color, type and size

    • -
    • fill: background fill color.

    • -

    For example, -panel.labs.background = list(color = "blue", fill = "pink").

    panel.labs.font

    a list of aestheics indicating the size (e.g.: 14), the -face/style (e.g.: "plain", "bold", "italic", "bold.italic") and the color -(e.g.: "red") and the orientation angle (e.g.: 45) of panel labels.

    panel.labs.font.x, panel.labs.font.y

    same as panel.labs.font but for x -and y direction, respectively.

    ...

    other arguments to pass to the function ggsurvplot.

    - - -

    Examples

    -
    library(survival) - -# Facet by one grouping variables: rx -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit <- survfit( Surv(time, status) ~ sex, data = colon ) -ggsurvplot_facet(fit, colon, facet.by = "rx", - palette = "jco", pval = TRUE)
    #> Warning: `as.tibble()` is deprecated as of tibble 2.0.0. -#> Please use `as_tibble()` instead. -#> The signature and semantics have changed, see `?as_tibble`. -#> This warning is displayed once every 8 hours. -#> Call `lifecycle::last_warnings()` to see where this warning was generated.
    -# Facet by two grouping variables: rx and adhere -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -ggsurvplot_facet(fit, colon, facet.by = c("rx", "adhere"), - palette = "jco", pval = TRUE)
    - -# Another fit -#:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit2 <- survfit( Surv(time, status) ~ sex + rx, data = colon ) -ggsurvplot_facet(fit2, colon, facet.by = "adhere", - palette = "jco", pval = TRUE)
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_group_by.html b/docs/reference/ggsurvplot_group_by.html deleted file mode 100644 index f13f3de..0000000 --- a/docs/reference/ggsurvplot_group_by.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - -Survival Curves of Grouped Data sets — ggsurvplot_group_by • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Survival curves of grouped data sets by one or two - variables.

    -

    Survival analysis are often done on subsets defined by - variables in the dataset. For example, assume that we have a cohort of - patients with a large number of clinicopathological and molecular - covariates, including survival data, TP53 mutation status and the patients' - sex (Male or Female).

    -

    One might be also interested in comparing the - survival curves of Male and Female after grouping (or splitting ) the data - by TP53 mutation status.

    -

    ggsurvplot_group_by() provides a - convenient solution to create a multiple ggsurvplot of a data set - grouped by one or two variables.

    -
    - -
    ggsurvplot_group_by(fit, data, group.by, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - -
    fit

    a survfit object.

    data

    a data frame used to fit survival curves.

    group.by

    a character vector containing the name of grouping variables. Should be of length <= 2.

    ...

    ... other arguments passed to the core function -ggsurvplot.

    - -

    Value

    - -

    Retuns a list of ggsurvplots.

    -

    Details

    - -

    ggsurvplot_group_by() works as follow:

      -
    1. Create a grouped data sets using the function surv_group_by(), --> list of data sets

    2. -
    3. Map surv_fit() to each nested data --> Returns a list of survfit objects

    4. -
    5. Map ggsurvplot() to each survfit object --> list of survfit ggsurvplots

    6. -

    One can (optionally) arrange the list of ggsurvplots using arrange_ggsurvplots()

    - -

    Examples

    -
    # Fit survival curves -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -library(survival) -fit <- survfit( Surv(time, status) ~ sex, data = colon ) - -# Visualize: grouped by treatment rx -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -ggsurv.list <- ggsurvplot_group_by(fit, colon, group.by = "rx", risk.table = TRUE, - pval = TRUE, conf.int = TRUE, palette = "jco") -names(ggsurv.list)
    #> [1] "rx.Obs::sex" "rx.Lev::sex" "rx.Lev+5FU::sex"
    - -# Visualize: grouped by treatment rx and adhere -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -ggsurv.list <- ggsurvplot_group_by(fit, colon, group.by = c("rx", "adhere"), - risk.table = TRUE, - pval = TRUE, conf.int = TRUE, palette = "jco") - -names(ggsurv.list)
    #> [1] "rx:Obs, adhere:0::sex" "rx:Obs, adhere:1::sex" -#> [3] "rx:Lev, adhere:0::sex" "rx:Lev, adhere:1::sex" -#> [5] "rx:Lev+5FU, adhere:0::sex" "rx:Lev+5FU, adhere:1::sex"
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvplot_list-1.png b/docs/reference/ggsurvplot_list-1.png deleted file mode 100644 index f60d8e2..0000000 Binary files a/docs/reference/ggsurvplot_list-1.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_list-2.png b/docs/reference/ggsurvplot_list-2.png deleted file mode 100644 index 1914dc3..0000000 Binary files a/docs/reference/ggsurvplot_list-2.png and /dev/null differ diff --git a/docs/reference/ggsurvplot_list.html b/docs/reference/ggsurvplot_list.html deleted file mode 100644 index 01cbf82..0000000 --- a/docs/reference/ggsurvplot_list.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - -Plot a List of Survfit Objects — ggsurvplot_list • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Take a list of survfit objects and produce a list of - ggsurvplots.

    -
    - -
    ggsurvplot_list(
    -  fit,
    -  data,
    -  title = NULL,
    -  legend.labs = NULL,
    -  legend.title = "Strata",
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    a list of survfit objects.

    data

    data used to fit survival curves. Can be also a list of same -length than fit.

    title

    title of the plot. Can be a character vector or a list of titles -of same length than fit. If title is not specified and -fit is a named list, then the names of fit list are used as title.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata. Can be a list when fit is a list.

    legend.title

    legend title for each plot. Can be a character vector or a -list of titles of same length than fit.

    ...

    other arguments passed to the core function -ggsurvplot

    - -

    Value

    - -

    Returns a list of ggsurvplots.

    -

    See also

    - - - -

    Examples

    -
    -library(survival) - -# Create a list of formulas -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -data(colon) -f1 <- survfit(Surv(time, status) ~ adhere, data = colon) -f2 <- survfit(Surv(time, status) ~ rx, data = colon) -fits <- list(sex = f1, rx = f2) - -# Visualize -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -legend.title <- list("sex", "rx") -ggsurvplot_list(fits, colon, legend.title = legend.title)
    #> $sex
    #> -#> $rx
    #> -#> attr(,"class") -#> [1] "list" "ggsurvplot_list"
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvtable-1.png b/docs/reference/ggsurvtable-1.png deleted file mode 100644 index fb28542..0000000 Binary files a/docs/reference/ggsurvtable-1.png and /dev/null differ diff --git a/docs/reference/ggsurvtable-2.png b/docs/reference/ggsurvtable-2.png deleted file mode 100644 index 0baf848..0000000 Binary files a/docs/reference/ggsurvtable-2.png and /dev/null differ diff --git a/docs/reference/ggsurvtable-3.png b/docs/reference/ggsurvtable-3.png deleted file mode 100644 index eec1a41..0000000 Binary files a/docs/reference/ggsurvtable-3.png and /dev/null differ diff --git a/docs/reference/ggsurvtable.html b/docs/reference/ggsurvtable.html deleted file mode 100644 index cdedfe4..0000000 --- a/docs/reference/ggsurvtable.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - - -Plot Survival Tables — ggrisktable • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Plot survival tables:

      -
    • ggrisktable(): Plot the number at risk table.

    • -
    • ggcumevents(): Plot the cumulative number of events table.

    • -
    • ggcumcensor(): Plot the cumulative number of censored subjects, the number of subjects who - exit the risk set, without an event, at time t. Normally, users don't need - to use this function directly.

    • -
    • ggsurvtable(): Generic function to plot any survival tables.

    • -

    Normally, users don't need to use this function directly. Internally used by the function - ggsurvplot.

    -
    - -
    ggrisktable(
    -  fit,
    -  data = NULL,
    -  risk.table.type = c("absolute", "percentage", "abs_pct", "nrisk_cumcensor",
    -    "nrisk_cumevents"),
    -  ...
    -)
    -
    -ggcumevents(fit, data = NULL, ...)
    -
    -ggcumcensor(fit, data = NULL, ...)
    -
    -ggsurvtable(
    -  fit,
    -  data = NULL,
    -  survtable = c("cumevents", "cumcensor", "risk.table"),
    -  risk.table.type = c("absolute", "percentage", "abs_pct", "nrisk_cumcensor",
    -    "nrisk_cumevents"),
    -  title = NULL,
    -  risk.table.title = NULL,
    -  cumevents.title = title,
    -  cumcensor.title = title,
    -  color = "black",
    -  palette = NULL,
    -  break.time.by = NULL,
    -  xlim = NULL,
    -  xscale = 1,
    -  xlab = "Time",
    -  ylab = "Strata",
    -  xlog = FALSE,
    -  legend = "top",
    -  legend.title = "Strata",
    -  legend.labs = NULL,
    -  y.text = TRUE,
    -  y.text.col = TRUE,
    -  fontsize = 4.5,
    -  font.family = "",
    -  axes.offset = TRUE,
    -  ggtheme = theme_survminer(),
    -  tables.theme = ggtheme,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    an object of class survfit. Can be a list containing two -components: 1) time: time variable used in survfit; 2) table: survival table -as generated by the internal function .get_timepoints_survsummary(). Can be -also a simple data frame.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    risk.table.type

    risk table type. Allowed values include: "absolute" or -"percentage": to show the absolute number and the percentage -of subjects at risk by time, respectively. Use "abs_pct" to show both -absolute number and percentage. Used only when survtable = "risk.table".

    ...

    other arguments passed to the function ggsurvtable and ggpar.

    survtable

    a character string specifying the type of survival table to plot.

    title

    the title of the plot.

    risk.table.title

    The title to be used for the risk table.

    cumevents.title

    The title to be used for the cumulative events table.

    cumcensor.title

    The title to be used for the cumcensor table.

    color

    color to be used for the survival curves.

      -
    • 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. In this -case, it's possible to specify a custom color palette by using the argument -palette.

    • -
    palette

    the color palette to be used. Allowed values include "hue" for -the default hue color scale; "grey" for grey color palettes; brewer palettes -e.g. "RdBu", "Blues", ...; or custom color palette e.g. c("blue", "red"); and scientific journal palettes from ggsci R package, e.g.: "npg", - "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and - "rickandmorty". -See details section for more information. Can be also a numeric vector of -length(groups); in this case a basic color palette is created using the -function palette.

    break.time.by

    numeric value controlling time axis breaks. Default value -is NULL.

    xlim

    x and y axis limits e.g. xlim = c(0, 1000), ylim = c(0, 1).

    xscale

    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.

    • -
    xlab

    main title and axis labels

    ylab

    main title and axis labels

    xlog

    logical value. If TRUE, x axis is tansformed into log scale.

    legend

    character specifying legend position. Allowed values are one of -c("top", "bottom", "left", "right", "none"). Default is "top" side position. -to remove the legend use legend = "none". Legend position can be also -specified using a numeric vector c(x, y); see details section.

    legend.title

    legend title.

    legend.labs

    character vector specifying legend labels. Used to replace -the names of the strata from the fit. Should be given in the same order as -those strata.

    y.text

    logical. Default is TRUE. If FALSE, the table y axis tick -labels will be hidden.

    y.text.col

    logical. Default value is FALSE. If TRUE, the table tick -labels will be colored by strata.

    fontsize

    text font size.

    font.family

    character vector specifying text element font family, e.g.: font.family = "Courier New".

    axes.offset

    logical value. Default is TRUE. If FALSE, set the plot axes -to start at the origin.

    ggtheme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme.

    tables.theme

    function, ggplot2 theme name. Default value is -theme_survminer. Allowed values include ggplot2 official themes: see -theme. Note that, tables.theme is incremental to ggtheme.

    - -

    Value

    - -

    a ggplot.

    -

    Functions

    - - -
      -
    • ggrisktable: Plot the number at risk table.

    • -
    • ggcumevents: Plot the cumulative number of events table

    • -
    • ggcumcensor: Plot the cumulative number of censor table

    • -
    • ggsurvtable: Generic function to plot survival tables: risk.table, cumevents and cumcensor

    • -
    - -

    Examples

    -
    # Fit survival curves -#::::::::::::::::::::::::::::::::::::::::::::::: -require("survival") -fit<- survfit(Surv(time, status) ~ sex, data = lung) - -# Survival tables -#::::::::::::::::::::::::::::::::::::::::::::::: -tables <- ggsurvtable(fit, data = lung, color = "strata", - y.text = FALSE) - -# Risk table -tables$risk.table
    -# Number of cumulative events -tables$cumevents
    -# Number of cumulative censoring -tables$cumcensor
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/ggsurvtheme-1.png b/docs/reference/ggsurvtheme-1.png deleted file mode 100644 index 79302da..0000000 Binary files a/docs/reference/ggsurvtheme-1.png and /dev/null differ diff --git a/docs/reference/ggsurvtheme.html b/docs/reference/ggsurvtheme.html deleted file mode 100644 index 47e6907..0000000 --- a/docs/reference/ggsurvtheme.html +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - -Theme for Survminer Plots — theme_survminer • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Default theme for plots generated with survminer.

    -
    - -
    theme_survminer(
    -  base_size = 12,
    -  base_family = "",
    -  font.main = c(16, "plain", "black"),
    -  font.submain = c(15, "plain", "black"),
    -  font.x = c(14, "plain", "black"),
    -  font.y = c(14, "plain", "black"),
    -  font.caption = c(15, "plain", "black"),
    -  font.tickslab = c(12, "plain", "black"),
    -  legend = c("top", "bottom", "left", "right", "none"),
    -  font.legend = c(10, "plain", "black"),
    -  ...
    -)
    -
    -theme_cleantable(base_size = 12, base_family = "", ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    base_size

    base font size

    base_family

    base font family

    font.main, font.submain, font.caption, font.x, font.y, font.tickslab, font.legend

    a vector of length 3 -indicating respectively the size (e.g.: 14), the style (e.g.: "plain", -"bold", "italic", "bold.italic") and the color (e.g.: "red") of main title, subtitle, caption, -xlab and ylab, axis tick labels and legend, respectively. For example font.x = -c(14, "bold", "red"). Use font.x = 14, to change only font size; or use -font.x = "bold", to change only font face.

    legend

    character specifying legend position. Allowed values are one of -c("top", "bottom", "left", "right", "none"). Default is "top" side position. -to remove the legend use legend = "none". Legend position can be also -specified using a numeric vector c(x, y); see details section.

    ...

    additional arguments passed to the function theme_survminer().

    - -

    Functions

    - - -
      -
    • theme_survminer: Default theme for survminer plots. A theme similar to theme_classic() with large font size.

    • -
    • theme_cleantable: theme for drawing a clean risk table and cumulative -number of events table. A theme similar to theme_survminer() without i) -axis lines and, ii) x axis ticks and title.

    • -
    - -

    Examples

    -
    -# Fit survival curves -#++++++++++++++++++++++++++++++++++++ -require("survival") -fit<- survfit(Surv(time, status) ~ sex, data = lung) - -# Basic survival curves -#++++++++++++++++++++++++++++++++++++ -ggsurv <- ggsurvplot(fit, data = lung, risk.table = TRUE, - main = "Survival curves", - submain = "Based on Kaplan-Meier estimates", - caption = "created with survminer" - ) - -# Change font size, style and color -#++++++++++++++++++++++++++++++++++++ -# Change font size, style and color at the same time -# Use font.x = 14, to change only font size; or use -# font.x = "bold", to change only font face. -ggsurv %+% theme_survminer( - font.main = c(16, "bold", "darkblue"), - font.submain = c(15, "bold.italic", "purple"), - font.caption = c(14, "plain", "orange"), - font.x = c(14, "bold.italic", "red"), - font.y = c(14, "bold.italic", "darkred"), - font.tickslab = c(12, "plain", "darkgreen") - ) - -# Clean risk table -# +++++++++++++++++++++++++++++ -ggsurv$table <- ggsurv$table + theme_cleantable() -ggsurv
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html deleted file mode 100644 index 6993317..0000000 --- a/docs/reference/index.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - -Function reference • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Fit survival curves

    -

    -
    -

    Survival Curves

    -

    Summarize and visualize survival curves.

    -
    -

    ggsurvplot() print(<ggsurvplot>)

    -

    Drawing Survival Curves Using ggplot2

    -

    ggflexsurvplot()

    -

    Ggplots of Fitted Flexible Survival Models

    -

    arrange_ggsurvplots()

    -

    Arranging Multiple ggsurvplots

    -

    ggsurvevents()

    -

    Distribution of Events' Times

    -

    surv_summary()

    -

    Nice Summary of a Survival Curve

    -

    surv_cutpoint() surv_categorize() summary(<surv_cutpoint>) print(<surv_cutpoint>) plot(<surv_cutpoint>) print(<plot_surv_cutpoint>)

    -

    Determine the Optimal Cutpoint for Continuous Variables

    -

    pairwise_survdiff()

    -

    Multiple Comparisons of Survival Curves

    -

    Diagnostics of Cox Model

    -

    -
    -

    ggcoxdiagnostics()

    -

    Diagnostic Plots for Cox Proportional Hazards Model with ggplot2

    -

    ggcoxfunctional() print(<ggcoxfunctional>)

    -

    Functional Form of Continuous Variable in Cox Proportional Hazards Model

    -

    ggcoxzph() print(<ggcoxzph>)

    -

    Graphical Test of Proportional Hazards with ggplot2

    -

    Summary of Cox Model

    -

    -
    -

    ggforest()

    -

    Forest Plot for Cox Proportional Hazards Model

    -

    ggadjustedcurves() surv_adjustedcurves()

    -

    Adjusted Survival Curves for Cox Proportional Hazards Model

    -

    Competing Risks

    -

    -
    -

    ggcompetingrisks()

    -

    Cumulative Incidence Curves for Competing Risks

    -

    Helpers

    -

    -
    -

    ggrisktable() ggcumevents() ggcumcensor() ggsurvtable()

    -

    Plot Survival Tables

    -

    ggsurvplot_df()

    -

    Plot Survival Curves from Survival Summary Data Frame

    -

    ggsurvplot_list()

    -

    Plot a List of Survfit Objects

    -

    ggsurvplot_group_by()

    -

    Survival Curves of Grouped Data sets

    -

    ggsurvplot_add_all()

    -

    Add Survival Curves of Pooled Patients onto the Main Plot

    -

    ggsurvplot_combine()

    -

    Combine a List of Survfit Objects on the Same Plot

    -

    ggsurvplot_facet()

    -

    Facet Survival Curves into Multiple Panels

    -

    Data

    -

    -
    -

    myeloma

    -

    Multiple Myeloma Data

    -

    BMT

    -

    Bone Marrow Transplant

    -

    Others

    -

    -
    -

    theme_survminer() theme_cleantable()

    -

    Theme for Survminer Plots

    -

    `+`(<ggsurv>) `%++%`

    -

    Add Components to a ggsurvplot

    -
    - - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/myeloma.html b/docs/reference/myeloma.html deleted file mode 100644 index 320d201..0000000 --- a/docs/reference/myeloma.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - - -Multiple Myeloma Data — myeloma • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Multiple Myeloma data extracted from publicly available gene - expression data (GEO Id: GSE4581).

    -
    - -
    data("myeloma")
    - - -

    Format

    - -

    A data frame with 256 rows and 12 columns.

    -
    molecular_group

    Patients' molecular subgroups

    -
    chr1q21_status

    Amplification status of the chromosome -1q21

    -
    treatment

    treatment

    event

    survival status 0 = -alive, 1 = dead

    time

    Survival time in months

    -
    CCND1

    Gene expression

    CRIM1

    Gene expression

    -
    DEPDC1

    Gene expression

    IRF4

    Gene expression

    -
    TP53

    Gene expression

    WHSC1

    Gene expression

    - - -

    The remaining columns (CCND1, CRIM1, DEPDC1, IRF4, TP53, WHSC1) correspond to -the gene expression level of specified genes.

    - -

    Examples

    -
    data(myeloma) -head(myeloma)
    #> molecular_group chr1q21_status treatment event time CCND1 CRIM1 -#> GSM50986 Cyclin D-1 3 copies TT2 0 69.24 9908.4 420.9 -#> GSM50988 Cyclin D-2 2 copies TT2 0 66.43 16698.8 52.0 -#> GSM50989 MMSET 2 copies TT2 0 66.50 294.5 617.9 -#> GSM50990 MMSET 3 copies TT2 1 42.67 241.9 11.9 -#> GSM50991 MAF <NA> TT2 0 65.00 472.6 38.8 -#> GSM50992 Hyperdiploid 2 copies TT2 0 65.20 664.1 16.9 -#> DEPDC1 IRF4 TP53 WHSC1 -#> GSM50986 523.5 16156.5 10.0 261.9 -#> GSM50988 21.1 16946.2 1056.9 363.8 -#> GSM50989 192.9 8903.9 1762.8 10042.9 -#> GSM50990 184.7 11894.7 946.8 4931.0 -#> GSM50991 212.0 7563.1 361.4 165.0 -#> GSM50992 341.6 16023.4 2096.3 569.2
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/pairwise_survdiff.html b/docs/reference/pairwise_survdiff.html deleted file mode 100644 index 92187af..0000000 --- a/docs/reference/pairwise_survdiff.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - -Multiple Comparisons of Survival Curves — pairwise_survdiff • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Calculate pairwise comparisons between group levels with - corrections for multiple testing.

    -
    - -
    pairwise_survdiff(formula, data, p.adjust.method = "BH", na.action, rho = 0)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    formula

    a formula expression as for other survival models, of the form -Surv(time, status) ~ predictors.

    data

    a data frame in which to interpret the variables occurring in the -formula.

    p.adjust.method

    method for adjusting p values (see -p.adjust). Allowed values include "holm", "hochberg", -"hommel", "bonferroni", "BH", "BY", "fdr", "none". If you don't want to -adjust the p value (not recommended), use p.adjust.method = "none".

    na.action

    a missing-data filter function. Default is -options()$na.action.

    rho

    a scalar parameter that controls the type of test. Allowed values -include 0 (for Log-Rank test) and 1 (for peto & peto test).

    - -

    Value

    - -

    Returns an object of class "pairwise.htest", which is a list - containing the p values.

    -

    See also

    - -

    survival::survdiff

    - -

    Examples

    -
    -library(survival) -library(survminer) -data(myeloma) - -# Pairwise survdiff -res <- pairwise_survdiff(Surv(time, event) ~ molecular_group, - data = myeloma) -res
    #> -#> Pairwise comparisons using Log-Rank test -#> -#> data: myeloma and molecular_group -#> -#> Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF -#> Cyclin D-2 0.723 - - - - -#> Hyperdiploid 0.943 0.723 - - - -#> Low bone disease 0.723 0.988 0.644 - - -#> MAF 0.644 0.447 0.523 0.485 - -#> MMSET 0.328 0.103 0.103 0.103 0.723 -#> Proliferation 0.103 0.038 0.038 0.062 0.485 -#> MMSET -#> Cyclin D-2 - -#> Hyperdiploid - -#> Low bone disease - -#> MAF - -#> MMSET - -#> Proliferation 0.527 -#> -#> P value adjustment method: BH
    -# Symbolic number coding -symnum(res$p.value, cutpoints = c(0, 0.0001, 0.001, 0.01, 0.05, 0.1, 1), - symbols = c("****", "***", "**", "*", "+", " "), - abbr.colnames = FALSE, na = "")
    #> Cyclin D-1 Cyclin D-2 Hyperdiploid Low bone disease MAF MMSET -#> Cyclin D-2 -#> Hyperdiploid -#> Low bone disease -#> MAF -#> MMSET -#> Proliferation * * + -#> attr(,"legend") -#> [1] 0 ‘****’ 1e-04 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘+’ 0.1 ‘ ’ 1 \t ## NA: ‘’
    - -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_cutpoint-1.png b/docs/reference/surv_cutpoint-1.png deleted file mode 100644 index d3d8385..0000000 Binary files a/docs/reference/surv_cutpoint-1.png and /dev/null differ diff --git a/docs/reference/surv_cutpoint-2.png b/docs/reference/surv_cutpoint-2.png deleted file mode 100644 index e3de30a..0000000 Binary files a/docs/reference/surv_cutpoint-2.png and /dev/null differ diff --git a/docs/reference/surv_cutpoint.html b/docs/reference/surv_cutpoint.html deleted file mode 100644 index a27995d..0000000 --- a/docs/reference/surv_cutpoint.html +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - - -Determine the Optimal Cutpoint for Continuous Variables — surv_cutpoint • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Determine the optimal cutpoint for one or multiple continuous - variables at once, using the maximally selected rank statistics from the - 'maxstat' R package. This is an outcome-oriented methods providing a - value of a cutpoint that correspond to the most significant relation with - outcome (here, survival).

      -
    • surv_cutpoint(): Determine the optimal cutpoint for each variable using 'maxstat'.

    • -
    • surv_categorize(): Divide each variable values based on the cutpoint returned by surv_cutpoint().

    • -
    - -
    - -
    surv_cutpoint(
    -  data,
    -  time = "time",
    -  event = "event",
    -  variables,
    -  minprop = 0.1,
    -  progressbar = TRUE
    -)
    -
    -surv_categorize(x, variables = NULL, labels = c("low", "high"))
    -
    -# S3 method for surv_cutpoint
    -summary(object, ...)
    -
    -# S3 method for surv_cutpoint
    -print(x, ...)
    -
    -# S3 method for surv_cutpoint
    -plot(x, variables = NULL, ggtheme = theme_classic(), bins = 30, ...)
    -
    -# S3 method for plot_surv_cutpoint
    -print(x, ..., newpage = TRUE)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    data

    a data frame containing survival information (time, event) and -continuous variables (e.g.: gene expression data).

    time, event

    column names containing time and event data, respectively. -Event values sould be 0 or 1.

    variables

    a character vector containing the names of variables of -interest, for wich we want to estimate the optimal cutpoint.

    minprop

    the minimal proportion of observations per group.

    progressbar

    logical value. If TRUE, show progress bar. Progressbar is -shown only, when the number of variables > 5.

    x, object

    an object of class surv_cutpoint

    labels

    labels for the levels of the resulting category.

    ...

    other arguments. For plots, see ?ggpubr::ggpar

    ggtheme

    function, ggplot2 theme name. Default value is -theme_classic. Allowed values include ggplot2 official themes. see -?ggplot2::ggtheme.

    bins

    Number of bins for histogram. Defaults to 30.

    newpage

    open a new page. See grid.arrange.

    - -

    Value

    - - -
      -
    • surv_cutpoint(): returns an object of class 'surv_cutpoint', - which is a list with the following components:

        -
      • maxstat - results for each variable (see ?maxstat::maxstat)

      • -
      • cutpoint: a data - frame containing the optimal cutpoint of each variable. Rows are variable - names and columns are c("cutpoint", "statistic").

      • -
      • data: a data frame - containing the survival data and the original data for the specified - variables.

      • -
      • minprop: the minimal proportion of observations per group.

      • -
      • not_numeric: contains data for non-numeric variables, in the context - where the user provided categorical variable names in the argument - variables.

      • -
      Methods defined for surv_cutpoint object are summary, print - and plot.

    • -
    • surv_categorize(): returns an object of class - 'surv_categorize', which is a data frame containing the survival data and - the categorized variables.

    • -
    - - -

    Examples

    -
    # 0. Load some data -data(myeloma) -head(myeloma)
    #> molecular_group chr1q21_status treatment event time CCND1 CRIM1 -#> GSM50986 Cyclin D-1 3 copies TT2 0 69.24 9908.4 420.9 -#> GSM50988 Cyclin D-2 2 copies TT2 0 66.43 16698.8 52.0 -#> GSM50989 MMSET 2 copies TT2 0 66.50 294.5 617.9 -#> GSM50990 MMSET 3 copies TT2 1 42.67 241.9 11.9 -#> GSM50991 MAF <NA> TT2 0 65.00 472.6 38.8 -#> GSM50992 Hyperdiploid 2 copies TT2 0 65.20 664.1 16.9 -#> DEPDC1 IRF4 TP53 WHSC1 -#> GSM50986 523.5 16156.5 10.0 261.9 -#> GSM50988 21.1 16946.2 1056.9 363.8 -#> GSM50989 192.9 8903.9 1762.8 10042.9 -#> GSM50990 184.7 11894.7 946.8 4931.0 -#> GSM50991 212.0 7563.1 361.4 165.0 -#> GSM50992 341.6 16023.4 2096.3 569.2
    -# 1. Determine the optimal cutpoint of variables -res.cut <- surv_cutpoint(myeloma, time = "time", event = "event", - variables = c("DEPDC1", "WHSC1", "CRIM1")) - -summary(res.cut)
    #> cutpoint statistic -#> DEPDC1 279.8 4.275452 -#> WHSC1 3205.6 3.361330 -#> CRIM1 82.3 1.968317
    -# 2. Plot cutpoint for DEPDC1 -# palette = "npg" (nature publishing group), see ?ggpubr::ggpar -plot(res.cut, "DEPDC1", palette = "npg")
    #> $DEPDC1
    #>
    -# 3. Categorize variables -res.cat <- surv_categorize(res.cut) -head(res.cat)
    #> time event DEPDC1 WHSC1 CRIM1 -#> GSM50986 69.24 0 high low high -#> GSM50988 66.43 0 low low low -#> GSM50989 66.50 0 low high high -#> GSM50990 42.67 1 low high low -#> GSM50991 65.00 0 low low low -#> GSM50992 65.20 0 high low low
    -# 4. Fit survival curves and visualize -library("survival") -fit <- survfit(Surv(time, event) ~DEPDC1, data = res.cat) -ggsurvplot(fit, data = res.cat, risk.table = TRUE, conf.int = TRUE)
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_fit.html b/docs/reference/surv_fit.html deleted file mode 100644 index bfa7c73..0000000 --- a/docs/reference/surv_fit.html +++ /dev/null @@ -1,394 +0,0 @@ - - - - - - - - -Create Survival Curves — surv_fit • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Wrapper arround the standard survfit() 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

    • -

    There are many cases, where this function might be useful:

      -
    • Case 1: One formula and One data set. - Example: You want to fit the survival curves of one biomarker/gene in a given data set. - This is the same as the standard survfit() function. Returns one survfit object.

    • -
    • Case 2: List of formulas and One data set. - Example: You want to fit the survival curves of a list of biormarkers/genes in the same data set. - Returns a named list of survfit objects in the same order as formulas.

    • -
    • Case 3: One formula and List of data sets. - Example: You want to fit survival curves of one biomarker/gene in multiple cohort of patients (colon, lung, breast). - Returns a named list of survfit objects in the same order as the data sets.

    • -
    • Case 4: List of formulas and List of data sets. - Example: You want to fit survival curves of multiple biomarkers/genes in multiple cohort of patients (colon, lung, breast). - Each formula will be applied to each of the data set in the data list. - Returns a named list of survfit objects.

    • -
    • Case 5: One formula and grouped data sets by one or two variables. - Example: One might like to plot the survival curves of patients - treated by drug A vs patients treated by drug B in a dataset grouped by TP53 and/or RAS mutations. - In this case use the argument group.by. Returns a named list of survfit objects.

    • -
    • Case 6. In a rare case you might have a list of formulas and a list of data sets, and - you might want to apply each formula to the mathcing data set with the same index/position in the list. - For example formula1 is applied to data 1, formula2 is applied to data 2, and so on ... - In this case formula and data lists should have the same length and you should specify the argument match.fd = TRUE ( stands for match formula and data). - Returns a named list of survfit objects.

    • -
    - -

    The output of the surv_fit() function can be directly handled by the following functions:

    -

    - - -

    These functions return one element or a list of elements depending on the format of the input.

    -
    - -
    surv_fit(formula, data, group.by = NULL, match.fd = FALSE, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - -
    formula

    survival formula. See survfit.formula. Can be a list of formula. Named lists are recommended.

    data

    a data frame in which to interpret the variables named in the formula. -Can be a list of data sets. Named lists are recommended. -Can be also a grouped dataset as generated by the function surv_group_by().

    group.by

    a grouping variables to group the data set by. -A character vector containing the name of grouping variables. Should be of length <= 2.

    match.fd

    logical value. Default is FALSE. Stands for "match formula and data". -Useful only when you have a list of formulas and a list of data sets, and - you want to apply each formula to the matching data set with the same index/position in the list. - For example formula1 is applied to data 1, formula2 is applied to data 2, and so on .... - In this case use match.fd = TRUE.

    ...

    Other arguments passed to the survfit.formula function.

    - -

    Value

    - - -
      -
    • Returns an object of class survfit if one formula and one data set provided.

    • -
    • Returns a named list of survfit objects when input is a list of formulas and/or data sets. -The same holds true when grouped data sets are provided or when the argument group.by is specified.

        -
      • If the names of formula and data lists are available, -the names of the resulting survfit objects list are obtained by collapsing the names of formula and data lists.

      • -
      • If the formula names are not available, the variables in the formulas are extracted and used to build the name of survfit object.

      • -
      • In the case of grouped data sets, the names of survfit object list are obtained by -collapsing the levels of grouping variables and the names of variables in the survival curve formulas.

      • -
    • -
    - - -

    Examples

    -
    -library("survival") -library("magrittr") - -# Case 1: One formula and One data set -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit <- surv_fit(Surv(time, status) ~ sex, - data = colon) -surv_pvalue(fit)
    #> variable pval method pval.txt -#> 1 sex 0.6107936 Log-rank p = 0.61
    - -# Case 2: List of formulas and One data set. -# - Different formulas are applied to the same data set -# - Returns a (named) list of survfit objects -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -# Create a named list of formulas -formulas <- list( - sex = Surv(time, status) ~ sex, - rx = Surv(time, status) ~ rx -) - -# Fit survival curves for each formula -fit <- surv_fit(formulas, data = colon) -surv_pvalue(fit)
    #> $`colon::sex` -#> variable pval method pval.txt -#> 1 sex 0.6107936 Log-rank p = 0.61 -#> -#> $`colon::rx` -#> variable pval method pval.txt -#> 1 rx 4.990735e-08 Log-rank p < 0.0001 -#>
    -# Case 3: One formula and List of data sets -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit <- surv_fit(Surv(time, status) ~ sex, - data = list(colon, lung)) -surv_pvalue(fit)
    #> $`colon::sex` -#> variable pval method pval.txt -#> 1 sex 0.6107936 Log-rank p = 0.61 -#> -#> $`lung::sex` -#> variable pval method pval.txt -#> 1 sex 0.001311165 Log-rank p = 0.0013 -#>
    - -# Case 4: List of formulas and List of data sets -# - Each formula is applied to each of the data in the data list -# - argument: match.fd = FALSE -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -# Create two data sets -set.seed(123) -colon1 <- dplyr::sample_frac(colon, 1/2) -set.seed(1234) -colon2 <- dplyr::sample_frac(colon, 1/2) - -# Create a named list of formulas -formula.list <- list( - sex = Surv(time, status) ~ sex, - adhere = Surv(time, status) ~ adhere, - rx = Surv(time, status) ~ rx -) - -# Fit survival curves -fit <- surv_fit(formula.list, data = list(colon1, colon2), - match.fd = FALSE)
    #> Warning: `combine()` is deprecated as of dplyr 1.0.0. -#> Please use `vctrs::vec_c()` instead. -#> This warning is displayed once every 8 hours. -#> Call `lifecycle::last_warnings()` to see where this warning was generated.
    #> $`colon1::sex` -#> variable pval method pval.txt -#> 1 sex 0.8372769 Log-rank p = 0.84 -#> -#> $`colon2::sex` -#> variable pval method pval.txt -#> 1 sex 0.3901548 Log-rank p = 0.39 -#> -#> $`colon1::adhere` -#> variable pval method pval.txt -#> 1 adhere 0.0125047 Log-rank p = 0.013 -#> -#> $`colon2::adhere` -#> variable pval method pval.txt -#> 1 adhere 0.02104745 Log-rank p = 0.021 -#> -#> $`colon1::rx` -#> variable pval method pval.txt -#> 1 rx 0.001173476 Log-rank p = 0.0012 -#> -#> $`colon2::rx` -#> variable pval method pval.txt -#> 1 rx 4.449283e-05 Log-rank p < 0.0001 -#>
    - -# Grouped survfit -#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -# - Group by the treatment "rx" and fit survival curves on each subset -# - Returns a list of survfit objects -fit <- surv_fit(Surv(time, status) ~ sex, - data = colon, group.by = "rx") - -# Alternatively, do this -fit <- colon %>% - surv_group_by("rx") %>% - surv_fit(Surv(time, status) ~ sex, data = .) - -surv_pvalue(fit)
    #> $`rx.Obs::sex` -#> variable pval method pval.txt -#> 1 sex 0.5337304 Log-rank p = 0.53 -#> -#> $`rx.Lev::sex` -#> variable pval method pval.txt -#> 1 sex 0.2928911 Log-rank p = 0.29 -#> -#> $`rx.Lev+5FU::sex` -#> variable pval method pval.txt -#> 1 sex 0.0005623961 Log-rank p = 0.00056 -#>
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_group_by.html b/docs/reference/surv_group_by.html deleted file mode 100644 index efeb903..0000000 --- a/docs/reference/surv_group_by.html +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - -Create a Grouped Dataset for Survival Analysis — surv_group_by • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Split a data frame into multiple new data frames based on one or - two grouping variables. The surv_group_by() function takes an - existing data frame and converts it into a grouped data frame where - survival analysis are performed "by group".

    -
    - -
    surv_group_by(data, grouping.vars)
    - -

    Arguments

    - - - - - - - - - - -
    data

    a data frame

    grouping.vars

    a character vector containing the name of grouping -variables. Should be of length <= 2

    - -

    Value

    - -

    Returns an object of class surv_group_by which is a - tibble data frame with the following components:

      -
    • one column for each grouping variables. Contains the levels.

    • -
    • a - coumn named "data", which is a named list of data subsets created by the - grouping variables. The list names are created by concatening the levels of - grouping variables.

    • -
    - - -

    Examples

    -
    library("survival") -library("magrittr") - -# Grouping by one variables: treatment "rx" -#:::::::::::::::::::::::::::::::::::::::::: -grouped.d <- colon %>% - surv_group_by("rx") - -grouped.d # print
    #> # A tibble: 3 x 2 -#> # Groups: rx [3] -#> rx data -#> * <fct> <named list> -#> 1 Obs <tibble [630 × 15]> -#> 2 Lev <tibble [620 × 15]> -#> 3 Lev+5FU <tibble [608 × 15]>
    -grouped.d$data # Access to the data
    #> $rx.Obs -#> # A tibble: 630 x 15 -#> id study sex age obstruct perfor adhere nodes status differ extent -#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 3 1 0 71 0 0 1 7 1 2 2 -#> 2 3 1 0 71 0 0 1 7 1 2 2 -#> 3 5 1 1 69 0 0 0 22 1 2 3 -#> 4 5 1 1 69 0 0 0 22 1 2 3 -#> 5 8 1 1 54 0 0 0 1 0 2 3 -#> 6 8 1 1 54 0 0 0 1 0 2 3 -#> 7 13 1 1 64 0 0 0 1 1 2 3 -#> 8 13 1 1 64 0 0 0 1 1 2 3 -#> 9 15 1 1 46 1 0 0 4 0 2 3 -#> 10 15 1 1 46 1 0 0 4 0 2 3 -#> # … with 620 more rows, and 4 more variables: surg <dbl>, node4 <dbl>, -#> # time <dbl>, etype <dbl> -#> -#> $rx.Lev -#> # A tibble: 620 x 15 -#> id study sex age obstruct perfor adhere nodes status differ extent -#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 7 1 1 77 0 0 0 5 1 2 3 -#> 2 7 1 1 77 0 0 0 5 1 2 3 -#> 3 9 1 1 46 0 0 1 2 0 2 3 -#> 4 9 1 1 46 0 0 1 2 0 2 3 -#> 5 11 1 0 47 0 0 1 1 0 2 3 -#> 6 11 1 0 47 0 0 1 1 0 2 3 -#> 7 14 1 1 68 1 0 0 3 1 2 3 -#> 8 14 1 1 68 1 0 0 3 1 2 3 -#> 9 17 1 1 62 1 0 1 6 1 2 3 -#> 10 17 1 1 62 1 0 1 6 1 2 3 -#> # … with 610 more rows, and 4 more variables: surg <dbl>, node4 <dbl>, -#> # time <dbl>, etype <dbl> -#> -#> $`rx.Lev+5FU` -#> # A tibble: 608 x 15 -#> id study sex age obstruct perfor adhere nodes status differ extent -#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 1 1 1 43 0 0 0 5 1 2 3 -#> 2 1 1 1 43 0 0 0 5 1 2 3 -#> 3 2 1 1 63 0 0 0 1 0 2 3 -#> 4 2 1 1 63 0 0 0 1 0 2 3 -#> 5 4 1 0 66 1 0 0 6 1 2 3 -#> 6 4 1 0 66 1 0 0 6 1 2 3 -#> 7 6 1 0 57 0 0 0 9 1 2 3 -#> 8 6 1 0 57 0 0 0 9 1 2 3 -#> 9 10 1 0 68 0 0 0 1 0 2 3 -#> 10 10 1 0 68 0 0 0 1 0 2 3 -#> # … with 598 more rows, and 4 more variables: surg <dbl>, node4 <dbl>, -#> # time <dbl>, etype <dbl> -#>
    -# Grouping by two variables -#:::::::::::::::::::::::::::::::::::::::::: -grouped.d <- colon %>% - surv_group_by(grouping.vars = c("rx", "adhere")) - grouped.d
    #> # A tibble: 6 x 3 -#> # Groups: rx, adhere [6] -#> rx adhere data -#> * <fct> <dbl> <named list> -#> 1 Obs 0 <tibble [536 × 14]> -#> 2 Obs 1 <tibble [94 × 14]> -#> 3 Lev 0 <tibble [522 × 14]> -#> 4 Lev 1 <tibble [98 × 14]> -#> 5 Lev+5FU 0 <tibble [530 × 14]> -#> 6 Lev+5FU 1 <tibble [78 × 14]>
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_median.html b/docs/reference/surv_median.html deleted file mode 100644 index f8c4f3a..0000000 --- a/docs/reference/surv_median.html +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - -Median of Survival Curves — surv_median • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Returns the median survival with upper and lower confidence - limits for the median at 95% confidence levels.

    -
    - -
    surv_median(fit, combine = FALSE)
    - -

    Arguments

    - - - - - - - - - - -
    fit

    A survfit object. Can be also a list of survfit objects.

    combine

    logical value. Used only when fit is a list of survfit objects. -If TRUE, combine the results for multiple fits.

    - -

    Value

    - -

    Returns for each fit, a data frame with the following column:

      -
    • strata: strata/group names

    • -
    • median: median survival of - each group

    • -
    • lower: 95% lower confidence limit

    • -
    • upper: 95% upper - confidence limit

    • -

    Returns a list of data frames when the input is a - list of survfit objects. If combine = TRUE, results are combined into one single data frame.

    - -

    Examples

    -
    -library(survival) - -# Different survfits -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit.null <- surv_fit(Surv(time, status) ~ 1, data = colon) - -fit1 <- surv_fit(Surv(time, status) ~ sex, data = colon) - -fit2 <- surv_fit(Surv(time, status) ~ adhere, data = colon) - -fit.list <- list(sex = fit1, adhere = fit2) - -# Extract the median survival -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -surv_median(fit.null)
    #> strata median lower upper -#> 1 All 2351 2018 2910
    -surv_median(fit2)
    #> strata median lower upper -#> 1 adhere=0 2718 2213 NA -#> 2 adhere=1 1272 997 1885
    -surv_median(fit.list)
    #> $sex -#> strata median lower upper -#> 1 sex=0 2174 1752 NA -#> 2 sex=1 2527 1976 2910 -#> -#> $adhere -#> strata median lower upper -#> 1 adhere=0 2718 2213 NA -#> 2 adhere=1 1272 997 1885 -#>
    -surv_median(fit.list, combine = TRUE)
    #> id strata median lower upper -#> 1 sex sex=0 2174 1752 NA -#> 2 sex sex=1 2527 1976 2910 -#> 3 adhere adhere=0 2718 2213 NA -#> 4 adhere adhere=1 1272 997 1885
    -# Grouped survfit -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit.list2 <- surv_fit(Surv(time, status) ~ sex, data = colon, - group.by = "rx") -surv_median(fit.list2)
    #> $`rx.Obs::sex` -#> strata median lower upper -#> 1 sex=0 1981 1272 NA -#> 2 sex=1 1539 1195 2284 -#> -#> $`rx.Lev::sex` -#> strata median lower upper -#> 1 sex=0 1885 1275 NA -#> 2 sex=1 1548 1061 2593 -#> -#> $`rx.Lev+5FU::sex` -#> strata median lower upper -#> 1 sex=0 NA 2021 NA -#> 2 sex=1 NA NA NA -#>
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_pvalue.html b/docs/reference/surv_pvalue.html deleted file mode 100644 index 49bec1f..0000000 --- a/docs/reference/surv_pvalue.html +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - -Compute P-value Comparing Survival Curves — surv_pvalue • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    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.

    -
    - -
    surv_pvalue(
    -  fit,
    -  data = NULL,
    -  method = "survdiff",
    -  test.for.trend = FALSE,
    -  combine = FALSE,
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    fit

    A survfit object. Can be also a list of survfit objects.

    data

    data frame used to fit survival curves. Can be also a list of -data.

    method

    method to compute survival curves. Default is "survdiff" (or -"log-rank"). Allowed values are one of:

      -
    • "survdiff", -log-rank;

    • -
    • "1": log-rank, LR; --> Regular log-rank test, sensitive to -detect late differences.

    • -
    • "n": Gehan-Breslow (generalized Wilcoxon), -GB; --> detect early differences.

    • -
    • "sqrtN": Tarone-Ware, TW; --> detect -early differences.

    • -
    • "S1": Peto-Peto's modified survival estimate, PP; ---> more robust than Tharone-Whare or Gehan-Breslow, detect early -differences

    • -
    • "S2": modified Peto-Peto (by Andersen), mPP

    • -
    • "FH_p=1_q=1": Fleming-Harrington(p=1, q=1), FH

    • -

    To specify method, one can -use either the weights (e.g.: "1", "n", "sqrtN", ...), or the full name -("log-rank", "gehan-breslow", "Peto-Peto", ...), or the acronyme LR, GB, -.... Case insensitive partial match is allowed.

    To learn more about -the mathematical background behind the different log-rank weights, read the -following blog post on R-Addict: -Comparing -(Fancy) Survival Curves with Weighted Log-rank Tests

    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.

    combine

    logical value. Used only when fit is a list of survfit objects. -If TRUE, combine the results for multiple fits.

    ...

    other arguments including pval, pval.coord, pval.method.coord. -These are only used internally to specify custom pvalue, pvalue and pvalue -method coordinates on the survival plot. Normally, users don't need these -arguments.

    - -

    Value

    - -

    Return a data frame with the columns (pval, method, pval.txt and - variable). If additional arguments (pval, pval.coord, pval.method.coord, - get_coord) are specified, then extra columns (pval.x, pval.y, method.x and - method.y) are returned.

      -
    • pval: pvalue

    • -
    • method: method - used to compute pvalues

    • -
    • pval.txt: formatted text ready to use for - annotating plots

    • -
    • pval.x, pval.y: x & y coordinates of the pvalue for - annotating the plot

    • -
    • method.x, method.y: x & y coordinates of pvalue - method

    • -
    - - -

    Examples

    -
    -library(survival) - -# Different survfits -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit.null <- surv_fit(Surv(time, status) ~ 1, data = colon) - -fit1 <- surv_fit(Surv(time, status) ~ sex, data = colon) - -fit2 <- surv_fit(Surv(time, status) ~ adhere, data = colon) - -fit.list <- list(sex = fit1, adhere = fit2) - -# Extract the median survival -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -surv_pvalue(fit.null)
    #> Warning: There are no survival curves to be compared. -#> This is a null model.
    #> variable pval method pval.txt -#> 1 NA
    -surv_pvalue(fit2, colon)
    #> variable pval method pval.txt -#> 1 adhere 0.0002670768 Log-rank p = 0.00027
    -surv_pvalue(fit.list)
    #> $sex -#> variable pval method pval.txt -#> 1 sex 0.6107936 Log-rank p = 0.61 -#> -#> $adhere -#> variable pval method pval.txt -#> 1 adhere 0.0002670768 Log-rank p = 0.00027 -#>
    -surv_pvalue(fit.list, combine = TRUE)
    #> id variable pval method pval.txt -#> 1 sex sex 0.6107936361 Log-rank p = 0.61 -#> 2 adhere adhere 0.0002670768 Log-rank p = 0.00027
    -# Grouped survfit -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -fit.list2 <- surv_fit(Surv(time, status) ~ sex, data = colon, - group.by = "rx") - -surv_pvalue(fit.list2)
    #> $`rx.Obs::sex` -#> variable pval method pval.txt -#> 1 sex 0.5337304 Log-rank p = 0.53 -#> -#> $`rx.Lev::sex` -#> variable pval method pval.txt -#> 1 sex 0.2928911 Log-rank p = 0.29 -#> -#> $`rx.Lev+5FU::sex` -#> variable pval method pval.txt -#> 1 sex 0.0005623961 Log-rank p = 0.00056 -#>
    -# Get coordinate for annotion of the survival plots -#::::::::::::::::::::::::::::::::::::::::::::::::::::::: -surv_pvalue(fit.list2, combine = TRUE, get_coord = TRUE)
    #> id variable pval method pval.txt pval.x pval.y -#> 1 rx.Obs::sex sex 0.5337303974 Log-rank p = 0.53 64.28 0.2 -#> 2 rx.Lev::sex sex 0.2928911335 Log-rank p = 0.29 66.58 0.2 -#> 3 rx.Lev+5FU::sex sex 0.0005623961 Log-rank p = 0.00056 66.18 0.2 -#> method.x method.y -#> 1 64.28 0.3 -#> 2 66.58 0.3 -#> 3 66.18 0.3
    -
    -
    - -
    - - -
    - - -
    -

    Site built with pkgdown 1.5.1.

    -
    - -
    -
    - - - - - - - - diff --git a/docs/reference/surv_summary.html b/docs/reference/surv_summary.html deleted file mode 100644 index c8b64a2..0000000 --- a/docs/reference/surv_summary.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - -Nice Summary of a Survival Curve — surv_summary • survminer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Compared to the default summary() function, surv_summary() - creates a data frame containing a nice summary from - survfit results.

    -
    - -
    surv_summary(x, data = NULL)
    - -

    Arguments

    - - - - - - - - - - -
    x

    an object of class survfit.

    data

    a dataset used to fit survival curves. If not supplied then data -will be extracted from 'fit' object.

    - -

    Value

    - -

    An object of class 'surv_summary', which is a data frame with - the following columns:

      -
    • time: the time points at which the - curve has a step.

    • -
    • n.risk: the number of subjects at risk at t.

    • -
    • n.event: the number of events that occur at time t.

    • -
    • n.censor: number - of censored events.

    • -
    • surv: estimate of survival.

    • -
    • std.err: - standard error of survival.

    • -
    • upper: upper end of confidence interval.

    • -
    • lower: lower end of confidence interval.

    • -
    • strata: stratification of survival curves.

    • -

    In a situation, where survival curves have been fitted with one or more - variables, surv_summary object contains extra columns representing the - variables. This makes it possible to facet the output of - ggsurvplot by strata or by some combinations of factors.

    -

    surv_summary object has also an attribut named 'table' containing - information about the survival curves, including medians of survival with - confidence intervals, as well as, the total number of subjects and the - number of event in each curve.

    - -

    Examples

    -
    -# Fit survival curves -require("survival") -fit <- survfit(Surv(time, status) ~ rx + adhere, data = colon) - -# Summarize -res.sum <- surv_summary(fit, data = colon) -head(res.sum)
    #> time n.risk n.event n.censor surv std.err upper lower -#> 1 20 536 1 0 0.9981343 0.001867414 1.0000000 0.9944878 -#> 2 43 535 1 0 0.9962687 0.002643394 1.0000000 0.9911204 -#> 3 45 534 1 0 0.9944030 0.003240519 1.0000000 0.9881072 -#> 4 59 533 1 0 0.9925373 0.003745345 0.9998501 0.9852780 -#> 5 72 532 1 0 0.9906716 0.004191364 0.9988435 0.9825667 -#> 6 77 531 1 0 0.9888060 0.004595738 0.9977529 0.9799393 -#> strata rx adhere -#> 1 rx=Obs, adhere=0 Obs 0 -#> 2 rx=Obs, adhere=0 Obs 0 -#> 3 rx=Obs, adhere=0 Obs 0 -#> 4 rx=Obs, adhere=0 Obs 0 -#> 5 rx=Obs, adhere=0 Obs 0 -#> 6 rx=Obs, adhere=0 Obs 0
    -# Information about the survival curves -attr(res.sum, "table")
    #> records n.max n.start events *rmean *se(rmean) median -#> rx=Obs, adhere=0 536 536 536 287 1884.796 57.33119 1896.0 -#> rx=Obs, adhere=1 94 94 94 58 1611.102 138.22808 1031.0 -#> rx=Lev, adhere=0 522 522 522 269 1890.034 60.48272 2012.0 -#> rx=Lev, adhere=1 98 98 98 64 1642.734 125.01246 1161.5 -#> rx=Lev+5FU, adhere=0 530 530 530 203 2285.457 55.43665 NA -#> rx=Lev+5FU, adhere=1 78 78 78 39 1946.302 152.86022 2174.0 -#> 0.95LCL 0.95UCL -#> rx=Obs, adhere=0 1447 2351 -#> rx=Obs, adhere=1 726 2077 -#> rx=Lev, adhere=0 1298 NA -#> rx=Lev, adhere=1 851 1895 -#> rx=Lev+5FU, adhere=0 NA NA -#> rx=Lev+5FU, adhere=1 993 NA
    - -
    -
    - -
    - - - -
    - - - - - - - - diff --git a/docs/survminer_cheatsheet.pdf b/docs/survminer_cheatsheet.pdf deleted file mode 100644 index e6c8107..0000000 Binary files a/docs/survminer_cheatsheet.pdf and /dev/null differ diff --git a/docs/tools/README-ggplot2-basic-survival-plot-1.png b/docs/tools/README-ggplot2-basic-survival-plot-1.png deleted file mode 100644 index 39b1840..0000000 Binary files a/docs/tools/README-ggplot2-basic-survival-plot-1.png and /dev/null differ diff --git a/docs/tools/README-ggplot2-customized-survival-plot-1.png b/docs/tools/README-ggplot2-customized-survival-plot-1.png deleted file mode 100644 index e1c9b57..0000000 Binary files a/docs/tools/README-ggplot2-customized-survival-plot-1.png and /dev/null differ diff --git a/docs/tools/README-ggplot2-more-customized-survival-plot-1.png b/docs/tools/README-ggplot2-more-customized-survival-plot-1.png deleted file mode 100644 index b308a64..0000000 Binary files a/docs/tools/README-ggplot2-more-customized-survival-plot-1.png and /dev/null differ diff --git a/docs/tools/README-ggplot2-uber-customized-survival-plot-1.png b/docs/tools/README-ggplot2-uber-customized-survival-plot-1.png deleted file mode 100644 index b4fe69f..0000000 Binary files a/docs/tools/README-ggplot2-uber-customized-survival-plot-1.png and /dev/null differ diff --git a/docs/tools/README-ggplot2-uber-platinium-customized-survival-plot-1.png b/docs/tools/README-ggplot2-uber-platinium-customized-survival-plot-1.png deleted file mode 100644 index 74595ab..0000000 Binary files a/docs/tools/README-ggplot2-uber-platinium-customized-survival-plot-1.png and /dev/null differ diff --git a/docs/tools/README-ggplot2-uber-platinium-premium-customized-survival-plot-1.png b/docs/tools/README-ggplot2-uber-platinium-premium-customized-survival-plot-1.png deleted file mode 100644 index 2b62e67..0000000 Binary files a/docs/tools/README-ggplot2-uber-platinium-premium-customized-survival-plot-1.png and /dev/null differ