Allow accepted role labels to be reused consistently
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
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Pascal-Kueng/dyadMLM
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Pascal-Kueng/dyadMLM#92 ·
Maintainers usually reply within 1 day
-
Warn when lag-1 columns are entirely missingPossibly taken @Pascal-Kueng claimed this 20 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Pascal-Kueng/dyadMLM#83 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Pascal-Kueng/dyadMLM#71 · 3 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Pascal-Kueng/dyadMLM#70 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Pascal-Kueng/dyadMLM#69 · 1 comment ·
Maintainers usually reply within 1 day
All issues in Pascal-Kueng/dyadMLM
Similar issues
-
beginner-task
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Rdatatable/data.table#7948 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
datacarpentry/semester-biology#1294 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
plot_components fails for logistic models with minmax scaling and no floorPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
insightsengineering/crane#333 ·