-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
degroup() for cross-classified data #521
Conversation
Tagging @jmgirard, you may review this PR. |
@etiennebacher Currently, when a variable name was misspelled, we simply ignore it and print a message (not even a warning!). Should we error here? library(datawizard)
data(efc, package = "datawizard")
degroup(
efc,
select = c("c12hour", "neg_c_8"),
by = c("e42dep", "c173code"),
suffix_demean = "_within"
) |> head()
#> Variables "neg_c_8" and "c173code" were not found in the dataset.
#> Did you mean one of "neg_c_7" or "c172code"?
#> c12hour_between c12hour_within
#> 1 52.7500 -36.75000
#> 2 52.7500 95.25000
#> 3 52.7500 17.25000
#> 4 NA NA
#> 5 106.9683 61.03175
#> 6 106.9683 -90.96825 Created on 2024-06-27 with reprex v2.1.0 |
Ok, the implementation of nested designs seems to be wrong (see #520 (comment)). I would remove that code and wait until we know how to do this correctly. |
I think this is ready to be merged? |
It works for the cross-classified case, as requested in #520. The extension to nested data structures came to my mind, but seems to be less trivial. I think this can be done later. The docs clearly state that |
That was an attempt to see if nested structures would work, but I then reverted the changed. So it's actually less new code you have to review ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @strengejacke !
Fixes #520