| Title: | KMunicate-Style Kaplan–Meier Plots |
| Version: | 0.2.5 |
| Description: | Produce Kaplan–Meier plots in the style recommended following the KMunicate study by Morris et al. (2019) <doi:10.1136/bmjopen-2019-030215>. The KMunicate style consists of Kaplan-Meier curves with confidence intervals to quantify uncertainty and an extended risk table (per treatment arm) depicting the number of study subjects at risk, events, and censored observations over time. The resulting plots are built using 'ggplot2' and can be further customised to a certain extent, including themes, fonts, and colour scales. |
| License: | MIT + file LICENSE |
| URL: | https://ellessenne.github.io/KMunicate-package/, https://github.com/ellessenne/KMunicate-package |
| BugReports: | https://github.com/ellessenne/KMunicate-package/issues |
| Depends: | R (≥ 2.10), survival |
| Imports: | checkmate, cowplot, ggplot2, pammtools, tidyr |
| Suggests: | broom, covr, devtools, knitr, rmarkdown, simsurv, testthat, usethis |
| VignetteBuilder: | knitr |
| ByteCompile: | true |
| Encoding: | UTF-8 |
| Language: | en-GB |
| LazyData: | true |
| RoxygenNote: | 7.3.1 |
| NeedsCompilation: | no |
| Packaged: | 2024-05-16 11:10:28 UTC; ellessenne |
| Author: | Alessandro Gasparini
|
| Maintainer: | Alessandro Gasparini <alessandro@ellessenne.xyz> |
| Repository: | CRAN |
| Date/Publication: | 2024-05-16 11:50:08 UTC |
KMunicate: KMunicate-Style Kaplan–Meier Plots
Description
Produce Kaplan–Meier plots in the style recommended following the KMunicate study by Morris et al. (2019) doi:10.1136/bmjopen-2019-030215. The KMunicate style consists of Kaplan-Meier curves with confidence intervals to quantify uncertainty and an extended risk table (per treatment arm) depicting the number of study subjects at risk, events, and censored observations over time. The resulting plots are built using 'ggplot2' and can be further customised to a certain extent, including themes, fonts, and colour scales.
Author(s)
Maintainer: Alessandro Gasparini alessandro@ellessenne.xyz (ORCID) [copyright holder]
Other contributors:
Ary Serpa Neto [contributor]
Peter Dutey (ORCID) [contributor]
See Also
Useful links:
Report bugs at https://github.com/ellessenne/KMunicate-package/issues
Create KMunicate-Style Kaplan–Meier Plots
Description
Produce Kaplan–Meier plots in the style recommended following the KMunicate study by TP Morris et al. (doi:10.1136/bmjopen-2019-030215).
Usage
KMunicate(
fit,
time_scale,
.risk_table = "KMunicate",
.reverse = FALSE,
.theme = NULL,
.color_scale = NULL,
.fill_scale = NULL,
.linetype_scale = NULL,
.annotate = NULL,
.xlab = "Time",
.ylab = ifelse(.reverse, "Estimated (1 - survival)", "Estimated survival"),
.title = NULL,
.alpha = 0.25,
.rel_heights = NULL,
.ff = NULL,
.risk_table_base_size = 11,
.size = NULL,
.legend_position = c(1, 1)
)
Arguments
fit |
A |
time_scale |
The time scale that will be used for the x-axis and for the summary tables. |
.risk_table |
This arguments define the type of risk table that is produced. |
.reverse |
If |
.theme |
|
.color_scale |
Colour scale used for the plot. Has to be a |
.fill_scale |
Fill scale used for the plot. Has to be a |
.linetype_scale |
Linetype scale used for the plot. Has to be a |
.annotate |
Optional annotation to be added to the plot, e.g. using |
.xlab |
Label for the horizontal axis, defaults to Time. |
.ylab |
Label for the vertical axis, defaults to Estimated survival if |
.title |
A title to be added on top of the plot. Defaults to |
.alpha |
Transparency of the point-wise confidence intervals |
.rel_heights |
Override default relative heights of plots and tables. Must be a numeric vector of length equal 1 + 1 per each arm in the Kaplan-Meier plot. See |
.ff |
A string used to define a base font for the plot. |
.risk_table_base_size |
Base font size for the risk table, given in pts. Defaults to 11. |
.size |
Thickness of each Kaplan-Meier curve. Defaults to |
.legend_position |
Position of the legend in the plot. Defaults to |
Value
A KMunicate-style ggplot object.
Examples
library(survival)
data("cancer2", package = "KMunicate")
KM <- survfit(Surv(studytime, died) ~ drug, data = cancer2)
time_scale <- seq(0, max(cancer2$studytime), by = 7)
KMunicate(fit = KM, time_scale = time_scale)
German Breast Cancer Study Data
Description
German breast cancer study data, imported from Stata 16.
Usage
brcancer
Format
A data frame with 686 rows and 14 variables:
-
idA numeric vector; -
hormonHormonal therapy; -
x1Age, in years; -
x2Menopausal status; -
x3Tumour size, mm; -
x4Tumour grade; -
x5Number of positive nodes; -
x6Progesterone receptor, fmol; -
rectimeRecurrence-free survival time, days; -
censrecCensoring indicator; -
x4aTumour grade >=2; -
x4bTumour grade == 3; -
x5eexp(-0.12 * x5).
References
http://www.stata-press.com/data/r16/brcancer.dta
Examples
data("brcancer", package = "KMunicate")
Patient Survival in Drug Trial
Description
Patient survival in drug trial data, imported from Stata 16.
Usage
cancer2
Format
A data frame with 48 rows and 4 variables:
-
studytimeMonths to death or end of follow-up; -
diedEvent indicator variable,died = 1if a patient died; -
drugDrug type, withdrug = 1being placebo; -
ageAge of a patient at baseline.
Note
The dataset is named cancer2 to avoid name collision with the cancer dataset from the survival package.
References
http://www.stata-press.com/data/r16/cancer.dta
Examples
data("cancer2", package = "KMunicate")