Skip to content
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

Add missing select helpers #376

Merged
merged 9 commits into from
Mar 14, 2023
Merged

Add missing select helpers #376

merged 9 commits into from
Mar 14, 2023

Conversation

etiennebacher
Copy link
Member

Close #133

Still need to do demean() but I think it should be renamed data_demean() since it only accepts dataframes

@etiennebacher
Copy link
Member Author

Still need to do demean() but I think it should be renamed data_demean() since it only accepts dataframes

@IndrajeetPatil @strengejacke do you agree on this?

@IndrajeetPatil
Copy link
Member

Still need to do demean() but I think it should be renamed data_demean() since it only accepts dataframes

@IndrajeetPatil @strengejacke do you agree on this?

Sounds reasonable to me, but we will need to do this in a backward-compatible manner.

We can add deprecation message for now, and remove the older version in a future release.

@strengejacke
Copy link
Member

Still need to do demean() but I think it should be renamed data_demean() since it only accepts dataframes

@IndrajeetPatil @strengejacke do you agree on this?

It's a decision between "accepts only data frames" and "belongs to the center and standardize family". You could argue therefore to keep this name.

@etiennebacher
Copy link
Member Author

Whether we rename it or not, introducing select helpers in demean() would lead to breaking changes because we allow interaction between selected variables, which is not supported by .select_nse() at the moment (and maybe never will?):

library(datawizard)

dat <- data.frame(
  a = c(1, 2, 3, 4),
  x = c(4, 3, 3, 4),
  y = c(1, 2, 1, 2),
  ID = c(1, 2, 3, 1)
)
demean(dat, select = c("a", "x*y"), group = "ID")
#>   a_between x_y_between a_within x_y_within
#> 1       2.5           6     -1.5         -2
#> 2       2.0           6      0.0          0
#> 3       3.0           3      0.0          0
#> 4       2.5           6      1.5          2

@strengejacke
Copy link
Member

I think we can just leave demean() as is. select-helpers are probably not that necessary here, because you usually have a limited set of variables in your model and even less that you want to demean (in practice). I think demeaning interaction terms (i.e. allow interactions in select) is here more important that the select-helper feature.

@etiennebacher etiennebacher mentioned this pull request Mar 14, 2023
7 tasks
@etiennebacher
Copy link
Member Author

etiennebacher commented Mar 14, 2023

Ok, demean() won't change and winsorize() (also in the list of #133) is still being worked on in other PRs so I don't modify it here.

@etiennebacher etiennebacher marked this pull request as ready for review March 14, 2023 12:10
@etiennebacher etiennebacher merged commit e203298 into main Mar 14, 2023
@etiennebacher etiennebacher deleted the missing-select-helpers branch March 14, 2023 17:09
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.

Missing select helpers
3 participants