Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 2, 2026

The code_unknown and recode_unknown parameters in recodeSex lacked test coverage, particularly for edge cases where code_unknown is NA and when unknown values are inferred from the data.

Changes

  • 7 new test cases covering:

    • Explicit code_unknown values
    • code_unknown = NA edge case (NA values recoded to unknown)
    • Automatic inference of unknown values when code_unknown is NULL
    • Custom recode_unknown parameter values
    • Behavior with only code_male or only code_female specified
    • Numeric code values
  • Improved documentation for code_unknown parameter to describe NA handling and automatic inference behavior

Example Usage

# code_unknown = NA: treats NA sex values as unknown
recodeSex(ped, code_male = "M", code_female = "F", code_unknown = NA, 
          recode_unknown = "Unknown")

# code_unknown = NULL: infers values not matching male/female as unknown
recodeSex(ped, code_male = "M", code_female = "F", recode_unknown = "U")
# Sex values "X", "?" automatically recoded to "U"

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

smasongarrison and others added 3 commits January 2, 2026 15:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI and others added 4 commits January 2, 2026 20:35
…arameters

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
@smasongarrison smasongarrison marked this pull request as ready for review January 2, 2026 20:39
Copilot AI changed the title [WIP] Update customizable sex coding based on review feedback Add test coverage for code_unknown and recode_unknown parameters in recodeSex Jan 2, 2026
Copilot AI requested a review from smasongarrison January 2, 2026 20:40
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.42%. Comparing base (e37cd10) to head (e216d9b).
⚠️ Report is 1 commits behind head on dev_main.

Additional details and impacted files
@@             Coverage Diff              @@
##           dev_main     #107      +/-   ##
============================================
+ Coverage     84.30%   84.42%   +0.12%     
============================================
  Files            25       25              
  Lines          3982     3982              
============================================
+ Hits           3357     3362       +5     
+ Misses          625      620       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smasongarrison smasongarrison merged commit 55c2afc into dev_main Jan 2, 2026
8 checks passed
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.

2 participants