The number of Wynton users over time

users_over_time(file = NULL, since = "2017-01-01")

Arguments

file

A file with a single column of signup dates, or NULL. If NULL, then the Wynton LDAP server is queried.

since

Drop signup dates prior to this date.

Value

A tibble::tibble with columns date and total, total the cumulative sum based on date occurances.

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

pathname <- system.file("exdata", "ldap_wynton_dates.txt", package = "wyntonquery")

signups <- users_over_time(pathname)
print(head(signups))
#> # A tibble: 6 × 2
#>   date       total
#>   <date>     <int>
#> 1 2017-02-21    11
#> 2 2017-04-25    12
#> 3 2017-05-23    13
#> 4 2017-07-04    14
#> 5 2017-08-10    15
#> 6 2017-08-11    16
print(tail(signups))
#> # A tibble: 6 × 2
#>   date       total
#>   <date>     <int>
#> 1 2026-02-07  1019
#> 2 2026-02-07  1020
#> 3 2026-02-07  1021
#> 4 2026-02-07  1022
#> 5 2026-02-07  1023
#> 6 2026-02-07  1024

## Summarize by year and month
signups <- mutate(signups, year = format(date, "%Y"))

## Signups per calendar year
signups <- mutate(signups, month = format(date, "%m"))
signups <- group_by(signups, year)
signups_per_year <- count(signups, name = "change")
signups_end_of_year <- filter(signups, date == max(date), total == max(total))
signups_per_year <- left_join(signups_per_year, signups_end_of_year)
#> Joining with `by = join_by(year)`
signups_per_year <- select(signups_per_year, year, change, total, per = date)
print(signups_per_year, n = Inf)
#> # A tibble: 10 × 4
#> # Groups:   year [10]
#>    year  change total per       
#>    <chr>  <int> <int> <date>    
#>  1 2017      15    25 2017-12-12
#>  2 2018      16    41 2018-11-30
#>  3 2019      60   101 2019-12-11
#>  4 2020      73   174 2020-12-22
#>  5 2021      86   260 2021-12-18
#>  6 2022     103   363 2022-12-21
#>  7 2023     118   481 2023-12-22
#>  8 2024     194   675 2024-12-28
#>  9 2025     299   974 2025-12-23
#> 10 2026      50  1024 2026-02-07

## Signups per calendar month
signups <- group_by(signups, year, month)
signups_per_month <- count(signups, name = "change")
signups_end_of_month <- filter(signups, date == max(date), total == max(total))
signups_per_month <- left_join(signups_per_month, signups_end_of_month)
#> Joining with `by = join_by(year, month)`
signups_per_month <- select(signups_per_month, year, month, change, total, per = date)
print(signups_per_month, n = Inf)
#> # A tibble: 103 × 5
#> # Groups:   year, month [103]
#>     year  month change total per       
#>     <chr> <chr>  <int> <int> <date>    
#>   1 2017  02         1    11 2017-02-21
#>   2 2017  04         1    12 2017-04-25
#>   3 2017  05         1    13 2017-05-23
#>   4 2017  07         1    14 2017-07-04
#>   5 2017  08         2    16 2017-08-11
#>   6 2017  09         1    17 2017-09-20
#>   7 2017  10         1    18 2017-10-23
#>   8 2017  11         5    23 2017-11-21
#>   9 2017  12         2    25 2017-12-12
#>  10 2018  01         1    26 2018-01-26
#>  11 2018  02         2    28 2018-02-26
#>  12 2018  03         2    30 2018-03-29
#>  13 2018  05         2    32 2018-05-14
#>  14 2018  07         1    33 2018-07-18
#>  15 2018  08         2    35 2018-08-24
#>  16 2018  09         3    38 2018-09-07
#>  17 2018  10         1    39 2018-10-12
#>  18 2018  11         2    41 2018-11-30
#>  19 2019  02         9    50 2019-02-21
#>  20 2019  03        15    65 2019-03-22
#>  21 2019  04         9    74 2019-04-30
#>  22 2019  05         6    80 2019-05-28
#>  23 2019  06         4    84 2019-06-30
#>  24 2019  07         1    85 2019-07-29
#>  25 2019  08         3    88 2019-08-26
#>  26 2019  09         2    90 2019-09-19
#>  27 2019  10         4    94 2019-10-31
#>  28 2019  11         5    99 2019-11-26
#>  29 2019  12         2   101 2019-12-11
#>  30 2020  01         5   106 2020-01-29
#>  31 2020  02         5   111 2020-02-29
#>  32 2020  03         6   117 2020-03-25
#>  33 2020  04         5   122 2020-04-20
#>  34 2020  05         7   129 2020-05-29
#>  35 2020  06         1   130 2020-06-02
#>  36 2020  07        11   141 2020-07-28
#>  37 2020  08        12   153 2020-08-31
#>  38 2020  09         7   160 2020-09-21
#>  39 2020  10         5   165 2020-10-30
#>  40 2020  11         7   172 2020-11-19
#>  41 2020  12         2   174 2020-12-22
#>  42 2021  01         7   181 2021-01-25
#>  43 2021  02         6   187 2021-02-26
#>  44 2021  03         5   192 2021-03-25
#>  45 2021  04         4   196 2021-04-27
#>  46 2021  05         6   202 2021-05-21
#>  47 2021  06         6   208 2021-06-30
#>  48 2021  07         4   212 2021-07-27
#>  49 2021  08         9   221 2021-08-30
#>  50 2021  09        13   234 2021-09-30
#>  51 2021  10        12   246 2021-10-27
#>  52 2021  11         6   252 2021-11-25
#>  53 2021  12         8   260 2021-12-18
#>  54 2022  01         8   268 2022-01-30
#>  55 2022  02         8   276 2022-02-26
#>  56 2022  03        10   286 2022-03-31
#>  57 2022  04         4   290 2022-04-27
#>  58 2022  05         7   297 2022-05-27
#>  59 2022  06         5   302 2022-06-25
#>  60 2022  07         8   310 2022-07-27
#>  61 2022  08         7   317 2022-08-31
#>  62 2022  09        22   339 2022-09-24
#>  63 2022  10        14   353 2022-10-26
#>  64 2022  11         8   361 2022-11-23
#>  65 2022  12         2   363 2022-12-21
#>  66 2023  01        10   373 2023-01-31
#>  67 2023  02         6   379 2023-02-24
#>  68 2023  03         7   386 2023-03-21
#>  69 2023  04        10   396 2023-04-26
#>  70 2023  05         6   402 2023-05-10
#>  71 2023  06        10   412 2023-06-30
#>  72 2023  07         7   419 2023-07-29
#>  73 2023  08        14   433 2023-08-29
#>  74 2023  09        26   459 2023-09-30
#>  75 2023  10        10   469 2023-10-24
#>  76 2023  11        10   479 2023-11-29
#>  77 2023  12         2   481 2023-12-22
#>  78 2024  01        14   495 2024-01-31
#>  79 2024  02        16   511 2024-02-29
#>  80 2024  03         8   519 2024-03-27
#>  81 2024  04        22   541 2024-04-24
#>  82 2024  05        11   552 2024-05-31
#>  83 2024  06        14   566 2024-06-28
#>  84 2024  07        18   584 2024-07-27
#>  85 2024  08        14   598 2024-08-31
#>  86 2024  09        39   637 2024-09-28
#>  87 2024  10        15   652 2024-10-31
#>  88 2024  11         6   658 2024-11-22
#>  89 2024  12        17   675 2024-12-28
#>  90 2025  01        27   702 2025-01-31
#>  91 2025  02        23   725 2025-02-28
#>  92 2025  03        17   742 2025-03-25
#>  93 2025  04        17   759 2025-04-30
#>  94 2025  05        19   778 2025-05-28
#>  95 2025  06        20   798 2025-06-30
#>  96 2025  07        30   828 2025-07-30
#>  97 2025  08        28   856 2025-08-29
#>  98 2025  09        39   895 2025-09-30
#>  99 2025  10        41   936 2025-10-30
#> 100 2025  11        24   960 2025-11-27
#> 101 2025  12        14   974 2025-12-23
#> 102 2026  01        33  1007 2026-01-30
#> 103 2026  02        17  1024 2026-02-07


if (require("ggplot2", quietly = TRUE)) {
  gg <- ggplot(signups, aes(date, total)) + geom_line(linewidth = 2.0)
  gg <- gg + xlab("") + ylab("Number of users")
  gg <- gg + theme(text = element_text(size = 20))
  print(gg)
}