Skip to content

Wagebill analytics - #101

Merged
ifeanyi588 merged 24 commits into
mainfrom
wagebill-analytics
Sep 17, 2026
Merged

ifeanyi588 merged 24 commits into
mainfrom
wagebill-analytics

Conversation

@galileukim

Copy link
Copy Markdown
Contributor

This PR:

  • Introduces novel wage bill modelling and demographic analysis.
  • Renames the function arguments, ensuring consistency.
  • Warns on deprecated argument names, to be removed in the next relase.
  • Fixes documentation and their rendering.
  • Fixes invalid and unused imports.

ifeanyi588 and others added 24 commits September 14, 2026 14:30
- Implement `.compute_decrement_pair()` to compute exit/stay outcome counts between consecutive snapshot pairs
- Implement `estimate_decrement_rates()` (exported) to pool decrement rates across all snapshot pairs in a panel
- Implement `.smooth_rate_curve()` and `smooth_decrement_rates()` to graduate and gap-fill rates via loess/linear interpolation
- Implement `compute_service_table()` to chain smoothed decrement rates into a multiple-decrement actuarial service table (lx, Lx, Tx, ex)
- Register new global variable bindings in zzz.R
- Add generated documentation and NAMESPACE export for `estimate_decrement_rates`
…exp` column to `ex`, update docs, and add tests
Audit every @importFrom tag against what the package actually exports and
what each file actually calls.

- Remove four `@importFrom govhr` self-imports; a package cannot import
  from itself.
- Point the ggthemes tag at `scale_colour_few()`, the spelling the code
  calls.
- Drop the unused `@importFrom validate` tag. `description` and `label`
  there were never validate functions but data.table column names, and
  the tag made `validate::summary()` mask `base::summary()` package-wide.
- Drop dead tags: `glue`, `tidyr::pivot_longer`, `grid::unit`,
  `ggplot2::arrow`/`position_jitter`, `data.table::.SD`, `dplyr::collect`,
  `across`/`everything`/`summarise`, `select`, `tibble::as_tibble`,
  `lubridate::years`.

Tests: 596 pass, 0 failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The sources already contained 518 backticks, 30 markdown lists and 9
*emphasis* spans, but markdown was never switched on, so all of it
rendered as literal characters and bullet lists collapsed into run-on
paragraphs. Enabling it regenerates 105 of 125 help files; all 124 Rd
files still pass tools::checkRd().

Also fix six @PARAM entries that documented the wrong arity:
`group_cols` was described as "a character string" on
compute_workforce_movement(), plot_movement(), plot_decile(),
plot_compression_ratio() and plot_movement_cost(), and `group_col` as
"a character vector" on compute_density(), which errors on two columns.

Tests: 596 pass, 0 failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The tidyverse reserves a dotted `.data` for functions that also take
`...`, so user column names cannot collide with the argument. Only 3 of
73 functions here take `...`, and they straddled both conventions, so
the 37/36 split between `data` and `.data` tracked nothing.

Rename `.data` to `data` on the 34 functions without `...`, and give
ggplot_point_line() the dotted name it should have had.
compute_baseline_index() and fastprop() keep `.data`.

`.data` is also the rlang pronoun, so the rename was driven off
getParseData() token positions rather than text matching: 104 argument
references were renamed and 97 pronoun uses inside data-masked calls
(aes(), vars(), dplyr verbs) were left alone. The data argument of a
masking call is not itself masked, which is what made
`fastcount(.data, ...)` and `dplyr::filter(.data, ...)` argument
references rather than pronouns.

Tests: 596 pass, 0 failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Grouping arguments carried four names for one concept: group_cols (20),
group (13), group_col (10) and groups (3). The _col/_cols suffix was
sound where used, so keep it and retire the bare forms, assigning each
function the suffix its actual arity demands. Arity was verified by
calling each function with one and two columns rather than trusting the
docs, which were wrong in both directions.

Also drop storage-type suffixes from argument names: personnel_dt ->
personnel, contract_dt/contract_df -> contracts, event_dt -> events,
decrement_dt -> decrements, est_dt -> establishments. The suffix was a
false promise; all of these accept a plain data.frame or tibble.

Old names still work via resolve_renamed_arg(), which warns and errors
if both names are supplied. ggplot_point_line(), ggplot_segment() and
sample_group() are renamed without a shim because their arguments are
evaluated lazily ({{ }} / enquo() / ensym()), which a forcing shim
cannot forward.

Call sites were rewritten off parse-tree positions so that aes(group =),
data.frame(group =) and dplyr's .groups were left untouched.

This also applies the tidyverse documentation style to the same roxygen
blocks: sentence-case titles, @return -> @returns, and @PARAM
descriptions that start with a capital and end with a full stop.

Tests: 605 pass (596 existing plus 9 new deprecation tests), 0 failures,
0 warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rewrite call sites in the vignettes and the pkgdown assessment article
off parse-tree positions, and update the prose that names the `group`
argument.

ggplot_point_line() and ggplot_segment() calls in the assessment article
passed bare symbols to `group`, which has no deprecation shim, so those
had to change. Several plot_trend() calls were reaching `group_col`
only through R's partial argument matching; they now name it in full.

All four vignettes render, and the rendered text is identical to the
pre-change output apart from the argument names shown in code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@galileukim galileukim added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 17, 2026
@ifeanyi588
ifeanyi588 merged commit c1bbcb5 into main Sep 17, 2026
6 checks passed
@galileukim
galileukim deleted the wagebill-analytics branch September 17, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants