Skip to content

Conversation

@dshkol
Copy link
Collaborator

@dshkol dshkol commented Jan 22, 2026

Summary

Replace deprecated dplyr functions with their modern equivalents.

Changes

M11: Replace deprecated mutate_at/vars with across()

Location: list_cansim_cubes() in R/cansim_tables_list.R

# Before (deprecated in dplyr 1.0.4+)
mutate_at(vars(ends_with("Date")), as.Date)
mutate_at(vars(matches("releaseTime")), function(d) ...)

# After
mutate(across(ends_with("Date"), as.Date))
mutate(across(matches("releaseTime"), \(d) ...))

This addresses deprecation warnings when using dplyr 1.0.4+.

Deferred Items

The following items from the audit plan require coauthor discussion before implementation:

  • H11: Standardize language parameter defaults

    • Some functions use language="english" (most), others use language="en"
    • Changing defaults could break existing code that relies on positional arguments
    • Both values are accepted by cleaned_ndm_language(), so behavior is identical
  • H12: Add parameter validation

    • Could reject previously accepted (but invalid) input
    • Needs discussion on error message formatting and edge cases
  • M12: Standardize refresh parameter

    • get_cansim() uses logical, get_cansim_connection() uses "auto"/TRUE/FALSE
    • Needs design discussion on unified approach
  • M13: default_month documentation

    • Upon review, documentation appears to be aligned with code
    • Different functions intentionally have different defaults ("01" vs "07")
  • M14: Extract language constants

    • Larger refactoring effort to create module-level constants
    • Could improve performance but adds complexity

Files Modified

  • R/cansim_tables_list.R: list_cansim_cubes() function

Test plan

  • devtools::check() passes (0 errors, 0 warnings)
  • All existing tests pass

Related Issues

Addresses code quality item from code audit plan. See #150-153 for discussion items requiring coauthor input.


🤖 Generated with Claude Code

mountainMath and others added 3 commits November 19, 2025 20:22
Replace deprecated dplyr functions in list_cansim_cubes():
- mutate_at(vars(ends_with("Date")), ...) → mutate(across(ends_with("Date"), ...))
- mutate_at(vars(matches("releaseTime")), ...) → mutate(across(matches("releaseTime"), ...))

This addresses deprecation warnings from dplyr 1.0.4+.

Note: Other API consistency items from the audit plan (H11, H12, M12, M13, M14)
are deferred as they require coauthor discussion:
- H11: Standardizing language parameter defaults could break existing code
- H12: Adding parameter validation could reject previously accepted input
- M12: Standardizing refresh parameter semantics needs design discussion
- M13: Documentation appears to be already aligned with code after review
- M14: Extracting language constants is a larger refactoring effort

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dshkol dshkol changed the base branch from master to v0.4.5 January 22, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants