From 003d3850e373e1251150228bbd2bd4cdeb90184c Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:55:24 +0000 Subject: [PATCH 1/5] docs: update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 6dd640d..c688b30 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,13 @@ add_parent_interval(dat) + + + + + + +
Tim Taylor
Tim Taylor

📖
From b86513628fbab8e45b4845ff25d7639d158e184e Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:55:25 +0000 Subject: [PATCH 2/5] docs: update .all-contributorsrc --- .all-contributorsrc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 7498da5..08e4d62 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,4 +1,21 @@ { "projectName": "NHSRepisodes", - "projectOwner": "nhs-r-community" + "projectOwner": "nhs-r-community", + "files": [ + "README.md" + ], + "commitType": "docs", + "commitConvention": "angular", + "contributorsPerLine": 7, + "contributors": [ + { + "login": "TimTaylor", + "name": "Tim Taylor", + "avatar_url": "https://avatars.githubusercontent.com/u/43499035?v=4", + "profile": "https://github.com/TimTaylor", + "contributions": [ + "doc" + ] + } + ] } From 7b134875a44f60394f92b76740668f3aa3e38a08 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:59:37 +0000 Subject: [PATCH 3/5] docs: update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c688b30..19d5ba2 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ add_parent_interval(dat) - +
Tim Taylor
Tim Taylor

📖
Tim Taylor
Tim Taylor

📖 ⚠️
From 2863c6604725909240b96a4228c2f8d67a9358a1 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:59:38 +0000 Subject: [PATCH 4/5] docs: update .all-contributorsrc --- .all-contributorsrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 08e4d62..0ac9b9a 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -14,7 +14,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/43499035?v=4", "profile": "https://github.com/TimTaylor", "contributions": [ - "doc" + "doc", + "test" ] } ] From 9b950e42d9a8b2ff6ea5bc333b39a057c60feab9 Mon Sep 17 00:00:00 2001 From: Lextuga007 Date: Mon, 7 Oct 2024 20:09:30 +0100 Subject: [PATCH 5/5] Added cache to TRUE so times are not rerun and added Contributors badge --- README.Rmd | 4 +++- README.md | 68 +++++++++++++++++++++++++----------------------------- 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/README.Rmd b/README.Rmd index daf4b4b..91342f5 100644 --- a/README.Rmd +++ b/README.Rmd @@ -19,7 +19,8 @@ knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", - out.width = "100%" + out.width = "100%", + cache = TRUE ) ``` @@ -28,6 +29,7 @@ knitr::opts_chunk$set( [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRepisodes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRepisodes/actions/workflows/R-CMD-check.yaml) +[![All Contributors](https://img.shields.io/github/all-contributors/nhs-r-community/NHSRepisodes?color=ee8449&style=flat-square)](#contributors) ## Installation instructions diff --git a/README.md b/README.md index 19d5ba2..5374c1d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/nhs-r-community/NHSRepisodes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRepisodes/actions/workflows/R-CMD-check.yaml) +[![All +Contributors](https://img.shields.io/github/all-contributors/nhs-r-community/NHSRepisodes?color=ee8449&style=flat-square)](#contributors) ## Installation instructions @@ -57,7 +59,7 @@ mutate(tibble(packages), version = sapply(packages, getNamespaceVersion)) #> packages version #> #> 1 NHSRepisodes 0.1.0.9000 -#> 2 dplyr 1.1.4.9000 +#> 2 dplyr 1.1.4 #> 3 data.table 1.16.0 #> 4 ivs 0.2.0 @@ -126,18 +128,18 @@ end2 <- start2 + sample(1:100, size = n * 5, replace = TRUE) # creates the object big_dat and shows the first 10 rows as a tibble in the console (big_dat <- tibble(id = id2, start = start2, end = end2)) #> # A tibble: 625,000 × 3 -#> id start end -#> -#> 1 90983 2020-02-07 2020-03-18 -#> 2 59640 2020-07-05 2020-08-13 -#> 3 29543 2020-04-05 2020-05-28 -#> 4 17962 2020-06-07 2020-07-21 -#> 5 13032 2020-08-25 2020-09-08 -#> 6 94348 2020-05-11 2020-06-07 -#> 7 7770 2020-03-18 2020-04-03 -#> 8 9570 2020-09-25 2020-12-04 -#> 9 86687 2020-11-04 2021-01-09 -#> 10 66213 2020-04-09 2020-04-16 +#> id start end +#> +#> 1 47215 2020-12-29 2021-02-16 +#> 2 91739 2020-09-16 2020-11-12 +#> 3 114791 2020-01-31 2020-02-27 +#> 4 83644 2020-08-17 2020-11-04 +#> 5 68824 2020-02-14 2020-05-06 +#> 6 100194 2020-12-11 2021-03-18 +#> 7 3871 2020-06-21 2020-07-06 +#> 8 118901 2020-01-09 2020-03-23 +#> 9 80676 2020-07-23 2020-08-19 +#> 10 84580 2020-07-17 2020-10-07 #> # ℹ 624,990 more rows # checking the time to run @@ -148,7 +150,7 @@ system.time( reframe(interval = iv_groups(interval, abutting = FALSE), .by = id) ) #> user system elapsed -#> 13.870 0.065 13.996 +#> 17.00 0.28 17.30 ``` If you were not already using it, this is likely the time you would @@ -175,32 +177,32 @@ fun <- function(s, e) { system.time(out_dt <- DT[, fun(start, end + 1), by = id]) #> user system elapsed -#> 14.972 0.022 14.984 +#> 19.26 0.49 19.77 ``` ***NHSRepisodes*** solves this with the `merge_episodes()` function: ``` r merge_episodes(big_dat) -#> # A tibble: 334,767 × 4 +#> # A tibble: 335,828 × 4 #> id .interval_number .episode_start .episode_end #> -#> 1 1 1 2020-04-16 2020-06-23 -#> 2 2 1 2020-01-12 2020-02-22 -#> 3 2 2 2020-07-22 2020-08-16 -#> 4 2 3 2020-09-27 2021-01-11 -#> 5 3 1 2020-01-06 2020-03-02 -#> 6 3 2 2020-03-08 2020-03-16 -#> 7 3 3 2020-06-05 2020-08-26 -#> 8 4 1 2020-02-05 2020-05-03 -#> 9 4 2 2020-05-19 2020-09-08 -#> 10 5 1 2020-01-14 2020-03-13 -#> # ℹ 334,757 more rows +#> 1 1 1 2020-01-15 2020-01-27 +#> 2 1 2 2020-02-13 2020-11-14 +#> 3 1 3 2020-11-15 2021-02-13 +#> 4 2 1 2020-01-03 2020-03-25 +#> 5 2 2 2020-03-31 2020-06-09 +#> 6 2 3 2020-10-31 2020-11-08 +#> 7 2 4 2020-12-17 2021-01-23 +#> 8 3 1 2020-03-08 2020-03-19 +#> 9 3 2 2020-04-13 2020-05-26 +#> 10 3 3 2020-11-30 2020-12-01 +#> # ℹ 335,818 more rows # And for comparison with earlier timings system.time(out <- merge_episodes(big_dat)) #> user system elapsed -#> 0.917 0.000 0.335 +#> 0.59 0.11 0.44 # equal output (subject to ordering) out <- out |> @@ -240,20 +242,12 @@ add_parent_interval(dat) #> 7 1 2020-01-01 2020-01-10 2020-01-01 2020-01-10 1 #> 8 1 2020-01-11 2020-01-12 2020-01-11 2020-01-12 2 ``` + ## Contributors - - - - - - -
Tim Taylor
Tim Taylor

📖 ⚠️
- -