Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Allow accepted role labels to be reused consistently

Open Beginner friendly
#62 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
data

Research direction

Start at R/utils_compositions.R around line 170 and R/data_prep_validation.R around line 470, where composition references and DSM role-order values are trimmed before lookup while the stored role labels keep their spaces. Add an exact-match path for accepted labels ahead of whitespace cleanup, then add regression tests in tests/testthat covering reuse of the returned composition label and the original " mother " style names. Done when those reuse cases pass and existing composition shortcuts still work in the full test suite.

Written by the indexing model from the issue text.

Description

bug good first issue priority: low

Role labels containing leading or trailing spaces, such as " mother ", are accepted by prepare_dyad_data().

However, those same labels can fail when the user selects a composition with keep_compositions or specifies the role order for the Dyadic Score Model with dsm_role_order. Even copying the exact composition label returned by the package does not work.

This is confusing: the package first accepts the labels, then reports that they are unknown.

Example

dat <- data.frame(
  dyad = rep(1:2, each = 2),
  member = rep(1:2, 2),
  role = rep(c(" mother ", " father "), 2),
  x = 1:4
)

prepared <- dyadMLM::prepare_dyad_data(
  dat, dyad, member,
  role = role,
  predictors = x
)

composition <- attr(
  prepared, "dyadMLM"
)$dyad_compositions$composition[[1]]

Using that exact returned label fails:

dyadMLM::prepare_dyad_data(
  dat, dyad, member,
  role = role,
  predictors = x,
  keep_compositions = composition
)

Supplying the exact original role names also fails:

dyadMLM::prepare_dyad_data(
  dat, dyad, member,
  role = role,
  predictors = x,
  model_types = "dsm",
  dsm_role_order = c(" mother ", " father ")
)

Expected behavior

Labels accepted during preparation should remain usable in later arguments. The package should not silently change the user’s role values.

Suggested fix and checks

The lookup code removes surrounding spaces from composition references and DSM role-order values, while the stored role labels retain their spaces.

  • Match exact accepted labels before applying any shorthand or whitespace cleanup.
  • Test reuse of the returned composition label and the original role names.
  • Confirm that ordinary labels and existing composition shortcuts still work.
Dominant language
R
Stars
1
Forks
2
Avg merge
2d 6h
Merged PRs (30d)
22

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Pascal-Kueng/dyadMLM

All issues in Pascal-Kueng/dyadMLM

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.