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    14
#> 2 2017-04-20    15
#> 3 2017-04-25    16
#> 4 2017-05-23    17
#> 5 2017-07-04    18
#> 6 2017-08-10    19
print(tail(signups))
#> # A tibble: 6 × 2
#>   date       total
#>   <date>     <int>
#> 1 2025-01-17  1390
#> 2 2025-01-17  1391
#> 3 2025-01-17  1392
#> 4 2025-01-17  1393
#> 5 2025-01-18  1394
#> 6 2025-01-18  1395

## 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: 9 × 4
#> # Groups:   year [9]
#>   year  change total per       
#>   <chr>  <int> <int> <date>    
#> 1 2017      26    39 2017-12-12
#> 2 2018      32    71 2018-11-30
#> 3 2019     104   175 2019-12-18
#> 4 2020     124   299 2020-12-22
#> 5 2021     140   439 2021-12-18
#> 6 2022     201   640 2022-12-21
#> 7 2023     231   871 2023-12-27
#> 8 2024     492  1363 2024-12-28
#> 9 2025      32  1395 2025-01-18

## 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: 93 × 5
#> # Groups:   year, month [93]
#>    year  month change total per       
#>    <chr> <chr>  <int> <int> <date>    
#>  1 2017  02         1    14 2017-02-21
#>  2 2017  04         2    16 2017-04-25
#>  3 2017  05         1    17 2017-05-23
#>  4 2017  07         1    18 2017-07-04
#>  5 2017  08         2    20 2017-08-11
#>  6 2017  09         2    22 2017-09-22
#>  7 2017  10         6    28 2017-10-27
#>  8 2017  11         9    37 2017-11-30
#>  9 2017  12         2    39 2017-12-12
#> 10 2018  01         1    40 2018-01-16
#> 11 2018  02         6    46 2018-02-26
#> 12 2018  03         3    49 2018-03-29
#> 13 2018  04         1    50 2018-04-10
#> 14 2018  05         2    52 2018-05-14
#> 15 2018  06         1    53 2018-06-12
#> 16 2018  07         3    56 2018-07-20
#> 17 2018  08         5    61 2018-08-30
#> 18 2018  09         3    64 2018-09-07
#> 19 2018  10         2    66 2018-10-12
#> 20 2018  11         5    71 2018-11-30
#> 21 2019  01         3    74 2019-01-17
#> 22 2019  02         9    83 2019-02-21
#> 23 2019  03        16    99 2019-03-22
#> 24 2019  04        14   113 2019-04-30
#> 25 2019  05         7   120 2019-05-20
#> 26 2019  06         6   126 2019-06-30
#> 27 2019  07         7   133 2019-07-29
#> 28 2019  08         5   138 2019-08-31
#> 29 2019  09        18   156 2019-09-28
#> 30 2019  10         7   163 2019-10-31
#> 31 2019  11         5   168 2019-11-26
#> 32 2019  12         7   175 2019-12-18
#> 33 2020  01         6   181 2020-01-29
#> 34 2020  02         8   189 2020-02-29
#> 35 2020  03         8   197 2020-03-25
#> 36 2020  04        10   207 2020-04-30
#> 37 2020  05        11   218 2020-05-28
#> 38 2020  06         2   220 2020-06-19
#> 39 2020  07        11   231 2020-07-29
#> 40 2020  08        19   250 2020-08-31
#> 41 2020  09        16   266 2020-09-29
#> 42 2020  10        12   278 2020-10-30
#> 43 2020  11        14   292 2020-11-19
#> 44 2020  12         7   299 2020-12-22
#> 45 2021  01        10   309 2021-01-28
#> 46 2021  02        12   321 2021-02-26
#> 47 2021  03         9   330 2021-03-25
#> 48 2021  04         9   339 2021-04-27
#> 49 2021  05         6   345 2021-05-21
#> 50 2021  06        11   356 2021-06-30
#> 51 2021  07         6   362 2021-07-27
#> 52 2021  08        14   376 2021-08-30
#> 53 2021  09        22   398 2021-09-30
#> 54 2021  10        16   414 2021-10-27
#> 55 2021  11        13   427 2021-11-25
#> 56 2021  12        12   439 2021-12-18
#> 57 2022  01        19   458 2022-01-30
#> 58 2022  02        14   472 2022-02-26
#> 59 2022  03        24   496 2022-03-31
#> 60 2022  04        12   508 2022-04-27
#> 61 2022  05        11   519 2022-05-27
#> 62 2022  06         9   528 2022-06-25
#> 63 2022  07        17   545 2022-07-27
#> 64 2022  08        20   565 2022-08-31
#> 65 2022  09        33   598 2022-09-24
#> 66 2022  10        20   618 2022-10-26
#> 67 2022  11        18   636 2022-11-29
#> 68 2022  12         4   640 2022-12-21
#> 69 2023  01        19   659 2023-01-31
#> 70 2023  02        15   674 2023-02-28
#> 71 2023  03        16   690 2023-03-24
#> 72 2023  04        17   707 2023-04-28
#> 73 2023  05        11   718 2023-05-10
#> 74 2023  06        19   737 2023-06-30
#> 75 2023  07        21   758 2023-07-29
#> 76 2023  08        18   776 2023-08-23
#> 77 2023  09        44   820 2023-09-30
#> 78 2023  10        19   839 2023-10-25
#> 79 2023  11        19   858 2023-11-29
#> 80 2023  12        13   871 2023-12-27
#> 81 2024  01        40   911 2024-01-31
#> 82 2024  02        40   951 2024-02-29
#> 83 2024  03        31   982 2024-03-29
#> 84 2024  04        44  1026 2024-04-27
#> 85 2024  05        26  1052 2024-05-31
#> 86 2024  06        33  1085 2024-06-28
#> 87 2024  07        41  1126 2024-07-31
#> 88 2024  08        35  1161 2024-08-31
#> 89 2024  09        75  1236 2024-09-28
#> 90 2024  10        50  1286 2024-10-31
#> 91 2024  11        32  1318 2024-11-28
#> 92 2024  12        45  1363 2024-12-28
#> 93 2025  01        32  1395 2025-01-18


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)
}