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

degroup() for cross-classified data #521

Merged
merged 24 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: datawizard
Title: Easy Data Wrangling and Statistical Transformations
Version: 0.11.0.4
Version: 0.11.0.5
Authors@R: c(
person("Indrajeet", "Patil", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-1995-6531", Twitter = "@patilindrajeets")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ CHANGES
frame, where the first column contains name of the variable for which
frequencies were calculated, and the second column contains the frequency table.

* `demean()` (and `degroup()`) now also work for cross-classified designs, or
more generally, for data with multiple grouping or cluster variables (i.e.
`by` can now specify more than one variable).

# datawizard 0.11.0

BREAKING CHANGES
Expand Down
362 changes: 206 additions & 156 deletions R/demean.R

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CMD
Carle
Catran
Crosstables
Dhaliwal
Disaggregating
DOI
De
Dom
Expand All @@ -16,6 +18,7 @@ GLMM
Gelman
Giesecke
Giesselmann
Guo
Heisig
Herrington
Hoffmann
Expand Down Expand Up @@ -79,6 +82,7 @@ midhinge
modelbased
modelling
nd
panelr
partialization
patilindrajeets
platykurtic
Expand Down
180 changes: 110 additions & 70 deletions man/demean.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions tests/testthat/_snaps/demean.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@
Code
head(x)
Output
Sepal.Length_between Species_between binary_between Species_setosa_between
1 5.925000 0.850000 0.375 0.4250000
2 5.925000 0.850000 0.375 0.4250000
3 5.925000 0.850000 0.375 0.4250000
4 5.862222 1.133333 0.400 0.2888889
5 5.925000 0.850000 0.375 0.4250000
6 5.862222 1.133333 0.400 0.2888889
Sepal.Length_between binary_between Species_between Species_setosa_between
1 5.925000 0.375 0.850000 0.4250000
2 5.925000 0.375 0.850000 0.4250000
3 5.925000 0.375 0.850000 0.4250000
4 5.862222 0.400 1.133333 0.2888889
5 5.925000 0.375 0.850000 0.4250000
6 5.862222 0.400 1.133333 0.2888889
Species_versicolor_between Species_virginica_between Sepal.Length_within
1 0.3000000 0.2750000 -0.8250000
2 0.3000000 0.2750000 -1.0250000
3 0.3000000 0.2750000 -1.2250000
4 0.2888889 0.4222222 -1.2622222
5 0.3000000 0.2750000 -0.9250000
6 0.2888889 0.4222222 -0.4622222
Species_within binary_within Species_setosa_within Species_versicolor_within
1 -0.850000 -0.375 0.5750000 -0.3000000
2 -0.850000 0.625 0.5750000 -0.3000000
3 -0.850000 -0.375 0.5750000 -0.3000000
4 -1.133333 0.600 0.7111111 -0.2888889
5 -0.850000 0.625 0.5750000 -0.3000000
6 -1.133333 -0.400 0.7111111 -0.2888889
binary_within Species_within Species_setosa_within Species_versicolor_within
1 -0.375 -0.850000 0.5750000 -0.3000000
2 0.625 -0.850000 0.5750000 -0.3000000
3 -0.375 -0.850000 0.5750000 -0.3000000
4 0.600 -1.133333 0.7111111 -0.2888889
5 0.625 -0.850000 0.5750000 -0.3000000
6 -0.400 -1.133333 0.7111111 -0.2888889
Species_virginica_within
1 -0.2750000
2 -0.2750000
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-center.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ test_that("center, factors (grouped data)", {
poorman::ungroup() %>%
poorman::pull(Species)

manual <- iris %>%
poorman::pull(Species)
manual <- poorman::pull(iris, Species)

expect_identical(datawizard, manual)
})
Expand Down
Loading
Loading