easystats / easystats/datawizard
expand `demean` to `degroup`
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 238
- Forks
- 18
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Description
Some ideas for expanding the demean function into a more general degroup (or decenter, or ??) function (listed by ease of implementation as I perceive it):
- Allow for group-centering around other functions. Popular choices I've seen:
median(),min(),max(), alsoMode()is popular for categorical predictors.
Mode <- function(x, multimodal = FALSE) {
uniqv <- unique(x)
tab <- tabulate(match(x, uniqv))
if (multimodal) {
idx <- which(tab==max(tab))
} else {
idx <- which.max(tab)
}
uniqv[idx]
}
-
Allow for more than 1 grouping var
Order of operations would be: splitybyG1, then splity_betweenbyG2, etc... (Would need a better naming scheme?) -
Center around an indexed value. For example, center
yaroundy[time==0], ory[condition=="a"]. Can be mixed with (1):max(y[time==0]), etc.
Contributor 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.
Research direction
Start by reading the existing demean function and its surrounding documentation and tests. Compare the proposed centering functions, multiple grouping variables, and indexed reference values, then clarify which scope and naming should be accepted. Done means one agreed API is implemented with documented behavior and coverage for its supported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100