{"id":33187124,"url":"https://ellessenne.github.io/KMunicate-package/","last_synced_at":"2025-11-25T18:00:42.953Z","repository":{"id":56935002,"uuid":"278591277","full_name":"ellessenne/KMunicate-package","owner":"ellessenne","description":"Create KMunicate-Style Kaplan–Meier Plots","archived":false,"fork":false,"pushed_at":"2024-05-16T12:38:52.000Z","size":34474,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T03:57:14.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ellessenne.github.io/KMunicate-package","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ellessenne.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-07-10T09:17:31.000Z","updated_at":"2024-05-16T12:38:56.000Z","dependencies_parsed_at":"2024-01-18T04:08:09.732Z","dependency_job_id":"7c94fe2a-4762-4d83-8818-4198376670ce","html_url":"https://github.com/ellessenne/KMunicate-package","commit_stats":{"total_commits":139,"total_committers":2,"mean_commits":69.5,"dds":0.3237410071942446,"last_synced_commit":"8072e3013adbdfe4feba81482c032c80d721b618"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ellessenne/KMunicate-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellessenne%2FKMunicate-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellessenne%2FKMunicate-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellessenne%2FKMunicate-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellessenne%2FKMunicate-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ellessenne","download_url":"https://codeload.github.com/ellessenne/KMunicate-package/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ellessenne%2FKMunicate-package/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286079811,"owners_count":27282121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-25T02:00:05.816Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T05:00:30.374Z","updated_at":"2025-11-25T18:00:42.942Z","avatar_url":"https://github.com/ellessenne.png","language":"R","funding_links":[],"categories":["Data and models"],"sub_categories":[],"readme":"---\noutput: github_document\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  fig.align = \"center\",\n  out.width = \"90%\",\n  dpi = 300,\n  warning = FALSE,\n  message = FALSE,\n  dev = \"ragg_png\"\n)\n```\n\n# KMunicate-Style Kaplan–Meier Plots\n\n\u003c!-- badges: start --\u003e\n[![Codecov test coverage](https://codecov.io/gh/ellessenne/KMunicate-package/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ellessenne/KMunicate-package?branch=master)\n[![CRAN status](https://www.r-pkg.org/badges/version/KMunicate)](https://CRAN.R-project.org/package=KMunicate)\n[![CRAN_Logs_Badge](http://cranlogs.r-pkg.org/badges/KMunicate)](https://cran.r-project.org/package=KMunicate)\n[![CRAN_Logs_Badge_Total](http://cranlogs.r-pkg.org/badges/grand-total/KMunicate)](https://cran.r-project.org/package=KMunicate)\n[![R-CMD-check](https://github.com/ellessenne/KMunicate-package/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ellessenne/KMunicate-package/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nThe 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). \n\n## Installation\n\nYou can install {KMunicate} from [CRAN](https://CRAN.R-project.org/package=KMunicate) by typing the following in your R console:\n\n``` r\ninstall.packages(\"KMunicate\")\n```\n\nAlternatively, you can install the dev version of {KMunicate} from [GitHub](https://github.com/ellessenne/KMunicate-package/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"ellessenne/KMunicate-package\")\n```\n\n## Example\n\n```{r packages}\nlibrary(survival)\nlibrary(KMunicate)\n```\n\nThe {KMunicate} package comes with a couple of bundled dataset, `cancer` and `brcancer`.\nThe main function is named `KMunicate`:\n\n```{r brcancer, fig.height = 7, fig.width = 7 / sqrt(2)}\nKM \u003c- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)\ntime_scale \u003c- seq(0, max(brcancer$rectime), by = 365)\nKMunicate(fit = KM, time_scale = time_scale)\n```\n\n```{r cancer, fig.height = 7, fig.width = 7 / sqrt(2)}\nKM \u003c- survfit(Surv(studytime, died) ~ drug, data = cancer2)\ntime_scale \u003c- seq(0, max(cancer2$studytime), by = 7)\nKMunicate(fit = KM, time_scale = time_scale)\n```\n\nYou also might wonder, does this work with a single arm?\nYes, yes it does:\n\n```{r cancer-single, fig.height = 6, fig.width = 6}\nKM \u003c- survfit(Surv(studytime, died) ~ 1, data = cancer2)\ntime_scale \u003c- seq(0, max(cancer2$studytime), by = 7)\nKMunicate(fit = KM, time_scale = time_scale)\n```\n\nFinally, you can also plot 1 - survival by using the argument `.reverse = TRUE`:\n\n```{r brcancer-reverse, fig.height = 7, fig.width = 7 / sqrt(2)}\nKM \u003c- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)\ntime_scale \u003c- seq(0, max(brcancer$rectime), by = 365)\nKMunicate(fit = KM, time_scale = time_scale, .reverse = TRUE)\n```\n\n## Customise Risk Table\n\nBy 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):\n\n```{r brcancer-KMunicate, fig.height = 7, fig.width = 7 / sqrt(2)}\nKM \u003c- survfit(Surv(rectime, censrec) ~ hormon, data = brcancer)\ntime_scale \u003c- seq(0, max(brcancer$rectime), by = 365)\nKMunicate(fit = KM, time_scale = time_scale)\n```\n\nAlternatively, it is possible to customise the risk table via the `.risk_table` argument. \nFor instance, if one wants to have interval-wise number of events and censored, just pass the `survfit` value to the `.risk_table` argument:\n\n```{r brcancer-survfit, fig.height = 7, fig.width = 7 / sqrt(2)}\nKMunicate(fit = KM, time_scale = time_scale, .risk_table = \"survfit\")\n```\n\nThis is the default output of the `summary.survfit()` function.\n\nFinally, it is also possible to fully omit the risk table by setting `.risk_table = NULL`:\n\n```{r brcancer-NULL, fig.height = 6 / sqrt(2), fig.width = 6}\nKMunicate(fit = KM, time_scale = time_scale, .risk_table = NULL)\n```\n\n## Custom Fonts\n\nAssuming you have set up your computer to use custom fonts with `ggplot2`, customising your KMunicate-style plot is trivial.\nAll you have to do is pass the font name as the `.ff` argument:\n\n```{r cancer-single-ff, fig.height = 6, fig.width = 6}\nKM \u003c- survfit(Surv(studytime, died) ~ 1, data = cancer2)\ntime_scale \u003c- seq(0, max(cancer2$studytime), by = 7)\nKMunicate(fit = KM, time_scale = time_scale, .ff = \"Times New Roman\")\n```\n\n## Further Customisation\n\nSeveral options to further customise each plot are provided, see e.g. the introductory vignette for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/ellessenne.github.io%2FKMunicate-package%2F","html_url":"https://awesome.ecosyste.ms/projects/ellessenne.github.io%2FKMunicate-package%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/ellessenne.github.io%2FKMunicate-package%2F/lists"}