Skip to content

Fix focal fill error when personID column uses non-default name#155

Merged
smasongarrison merged 3 commits intomainfrom
copilot/fix-non-standard-personid-error
Apr 7, 2026
Merged

Fix focal fill error when personID column uses non-default name#155
smasongarrison merged 3 commits intomainfrom
copilot/fix-non-standard-personid-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

When personID is set to anything other than "personID" (e.g., personID = "ID"), enabling focal fill throws an error because the join and type-coercion logic hardcoded the literal column name "personID".

# Previously errored — workaround was to rename column to "personID"
ggPedigreeInteractive(df, personID = "ID", config = list(
  focal_fill_personID = some_id,
  focal_fill_include  = TRUE
))

Changes

  • addFocalFillColumn() — wrong join_by direction
    join_by(personID == !!rlang::sym(personID)) looked for a literal "personID" column in ds_ped (left side). Swapped to join_by(!!rlang::sym(personID) == personID) so the left side uses the caller-supplied column name and the right side matches the always-"personID"-named column in fill_df.

  • createFillColumn() — hardcoded ped$personID in type coercion
    is.numeric(ped$personID) returns NULL (falsy) when the column isn't literally named "personID", silently skipping numeric coercion and causing a type mismatch on join. Changed to ped[[personID]].

  • Error message updated to reflect the actual column name rather than the hardcoded string "ped$personID".

  • New test covers the non-standard column name path with focal fill enabled.

- Fix join_by sides in addFocalFillColumn: use dynamic personID on
  left (ds_ped column) and literal 'personID' on right (fill_df column)
- Fix type coercion in createFillColumn: use ped[[personID]] instead
  of hardcoded ped$personID
- Fix error message to show actual column name
- Add test for non-standard personID column name with focal fill

Agent-Logs-Url: https://github.com/R-Computing-Lab/ggpedigree/sessions/e2c6c87a-e37f-42e8-b68e-bf84f1f6b430

Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix non-standard personID errors for focal fill Fix focal fill error when personID column uses non-default name Apr 7, 2026
Copilot AI requested a review from smasongarrison April 7, 2026 16:00
@smasongarrison smasongarrison marked this pull request as ready for review April 7, 2026 17:27
@smasongarrison smasongarrison merged commit 86c8b55 into main Apr 7, 2026
7 checks passed
@smasongarrison smasongarrison deleted the copilot/fix-non-standard-personid-error branch April 7, 2026 18:30
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.

[Bug] non-standard personID's lead to error for focal fill

2 participants