Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 3 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.6%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
Create KMunicate-Style Kaplan–Meier Plots
Basic Info
- Host: GitHub
- Owner: ellessenne
- License: other
- Language: R
- Default Branch: master
- Homepage: https://ellessenne.github.io/KMunicate-package
- Size: 32.9 MB
Statistics
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 1
- Releases: 0
Created about 6 years ago
· Last pushed about 2 years ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.align = "center",
out.width = "90%",
dpi = 300,
warning = FALSE,
message = FALSE,
dev = "ragg_png"
)
```
# KMunicate-Style Kaplan–Meier Plots
[](https://app.codecov.io/gh/ellessenne/KMunicate-package?branch=master)
[](https://CRAN.R-project.org/package=KMunicate)
[](https://cran.r-project.org/package=KMunicate)
[](https://cran.r-project.org/package=KMunicate)
[](https://github.com/ellessenne/KMunicate-package/actions/workflows/R-CMD-check.yaml)
The goal of {KMunicate} is to produce Kaplan–Meier plots in the style recommended following the [KMunicate study](http://dx.doi.org/10.1136/bmjopen-2019-030215) (TP Morris *et al*. Proposals on Kaplan–Meier plots in medical research and a survey of stakeholder views: KMunicate. *BMJ Open*, 2019, 9:e030215).
## Installation
You can install {KMunicate} from [CRAN](https://CRAN.R-project.org/package=KMunicate) by typing the following in your R console:
``` r
install.packages("KMunicate")
```
Alternatively, you can install the dev version of {KMunicate} from [GitHub](https://github.com/ellessenne/KMunicate-package/) with:
``` r
# install.packages("devtools")
devtools::install_github("ellessenne/KMunicate-package")
```
## Example
```{r packages}
library(survival)
library(KMunicate)
```
The {KMunicate} package comes with a couple of bundled dataset, `cancer` and `brcancer`.
The main function is named `KMunicate`:
```{r brcancer, fig.height = 7, fig.width = 7 / sqrt(2)}
KM <- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)
time_scale <- seq(0, max(brcancer$rectime), by = 365)
KMunicate(fit = KM, time_scale = time_scale)
```
```{r cancer, fig.height = 7, fig.width = 7 / sqrt(2)}
KM <- survfit(Surv(studytime, died) ~ drug, data = cancer2)
time_scale <- seq(0, max(cancer2$studytime), by = 7)
KMunicate(fit = KM, time_scale = time_scale)
```
You also might wonder, does this work with a single arm?
Yes, yes it does:
```{r cancer-single, fig.height = 6, fig.width = 6}
KM <- survfit(Surv(studytime, died) ~ 1, data = cancer2)
time_scale <- seq(0, max(cancer2$studytime), by = 7)
KMunicate(fit = KM, time_scale = time_scale)
```
Finally, you can also plot 1 - survival by using the argument `.reverse = TRUE`:
```{r brcancer-reverse, fig.height = 7, fig.width = 7 / sqrt(2)}
KM <- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)
time_scale <- seq(0, max(brcancer$rectime), by = 365)
KMunicate(fit = KM, time_scale = time_scale, .reverse = TRUE)
```
## Customise Risk Table
By default, `KMunicate()` will build a risk table conform to the KMunicate style, e.g., with cumulative number of events and censored (the column-wise sum is equal to the total number of individuals at risk per arm):
```{r brcancer-KMunicate, fig.height = 7, fig.width = 7 / sqrt(2)}
KM <- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)
time_scale <- seq(0, max(brcancer$rectime), by = 365)
KMunicate(fit = KM, time_scale = time_scale)
```
Alternatively, it is possible to customise the risk table via the `.risk_table` argument.
For instance, if one wants to have interval-wise number of events and censored, just pass the `survfit` value to the `.risk_table` argument:
```{r brcancer-survfit, fig.height = 7, fig.width = 7 / sqrt(2)}
KMunicate(fit = KM, time_scale = time_scale, .risk_table = "survfit")
```
This is the default output of the `summary.survfit()` function.
Finally, it is also possible to fully omit the risk table by setting `.risk_table = NULL`:
```{r brcancer-NULL, fig.height = 6 / sqrt(2), fig.width = 6}
KMunicate(fit = KM, time_scale = time_scale, .risk_table = NULL)
```
## Custom Fonts
Assuming you have set up your computer to use custom fonts with `ggplot2`, customising your KMunicate-style plot is trivial.
All you have to do is pass the font name as the `.ff` argument:
```{r cancer-single-ff, fig.height = 6, fig.width = 6}
KM <- survfit(Surv(studytime, died) ~ 1, data = cancer2)
time_scale <- seq(0, max(cancer2$studytime), by = 7)
KMunicate(fit = KM, time_scale = time_scale, .ff = "Times New Roman")
```
## Further Customisation
Several options to further customise each plot are provided, see e.g. the introductory vignette for more details.
Owner
- Name: Alessandro Gasparini
- Login: ellessenne
- Kind: user
- Location: Stockholm, Sweden
- Company: @RedDoorAnalytics
- Website: https://www.ellessenne.xyz
- Twitter: ellessenne
- Repositories: 9
- Profile: https://github.com/ellessenne
Senior biostatistician, #rstats developer, data aficionado, outdoor enthusiast, pizza fanatic.
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Alessandro Gasparini | e****e@g****m | 94 |
| Alessandro Gasparini | g****t@e****z | 45 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 2 years ago
All Time
- Total issues: 11
- Total pull requests: 0
- Average time to close issues: 16 days
- Average time to close pull requests: N/A
- Total issue authors: 3
- Total pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 0
- Average time to close issues: about 10 hours
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ellessenne (10)
- peterdutey (1)
- sbalci (1)
- anddis (1)
Pull Request Authors
- peterdutey (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 392 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 8
- Total maintainers: 1
cran.r-project.org: KMunicate
KMunicate-Style Kaplan–Meier Plots
- Homepage: https://ellessenne.github.io/KMunicate-package/
- Documentation: http://cran.r-project.org/web/packages/KMunicate/KMunicate.pdf
- License: MIT + file LICENSE
-
Latest release: 0.2.5
published about 2 years ago
Rankings
Stargazers count: 19.3%
Forks count: 21.0%
Dependent repos count: 24.0%
Average: 26.7%
Dependent packages count: 28.8%
Downloads: 40.4%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- survival * depends
- checkmate * imports
- cowplot * imports
- ggplot2 * imports
- pammtools * imports
- tidyr * imports
- broom * suggests
- covr * suggests
- devtools * suggests
- knitr * suggests
- rmarkdown * suggests
- simsurv * suggests
- testthat * suggests
- usethis * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/cache v2 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite