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 Kish-method to rescale_weights #575

Merged
merged 47 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a55625d
Add Kish-method to `rescale_weights`
strengejacke Dec 17, 2024
6da102a
fix
strengejacke Dec 17, 2024
469a881
fix
strengejacke Dec 17, 2024
c08b07a
lintr
strengejacke Dec 17, 2024
3cfc128
fix
strengejacke Dec 17, 2024
46e7b6c
fix
strengejacke Dec 17, 2024
ff72739
fix
strengejacke Dec 17, 2024
80d9746
docs
strengejacke Dec 18, 2024
5463eb3
docs
strengejacke Dec 18, 2024
456166b
remove experimental code for now
strengejacke Dec 18, 2024
dd8ca23
docs
strengejacke Dec 18, 2024
33f8482
fix, add tests
strengejacke Dec 18, 2024
8bd8ebe
fix, add tests
strengejacke Dec 18, 2024
9b093ff
add tests
strengejacke Dec 18, 2024
80b7e3a
add tests
strengejacke Dec 18, 2024
2b24120
styler
strengejacke Dec 18, 2024
3c0af2c
lintr, wordlist
strengejacke Dec 18, 2024
f466642
docs
strengejacke Dec 18, 2024
8214df0
fix
strengejacke Dec 18, 2024
5ad1bcb
docs, tests, rename into rescaled_weights
strengejacke Dec 18, 2024
6415437
docs
strengejacke Dec 18, 2024
75843e6
Merge branch 'main' into rescale_weights_kish
strengejacke Dec 18, 2024
6778a51
Update R/rescale_weights.R
strengejacke Dec 18, 2024
749cb2f
Update NEWS.md
strengejacke Dec 18, 2024
d085d8c
Update R/rescale_weights.R
strengejacke Dec 18, 2024
98695f2
address comments
strengejacke Dec 18, 2024
164aea8
fix test
strengejacke Dec 19, 2024
f54a939
Merge branch 'main' into rescale_weights_kish
strengejacke Dec 23, 2024
6e14888
Merge branch 'main' into rescale_weights_kish
strengejacke Dec 23, 2024
39136e8
Merge branch 'main' into rescale_weights_kish
strengejacke Dec 31, 2024
c055e3b
address comments (docs)
strengejacke Dec 31, 2024
dcfc246
implement by
strengejacke Dec 31, 2024
f56e84c
implement `by`
strengejacke Dec 31, 2024
67b9ddc
typo
strengejacke Dec 31, 2024
4512769
update examples
strengejacke Dec 31, 2024
02283ee
docs
strengejacke Dec 31, 2024
71795b5
fix
strengejacke Dec 31, 2024
725b631
fix
strengejacke Dec 31, 2024
5fc7686
fix
strengejacke Dec 31, 2024
cff6780
desc
strengejacke Dec 31, 2024
2d9d111
fix, add tests
strengejacke Dec 31, 2024
05efe33
examples
strengejacke Dec 31, 2024
126ee64
docs
strengejacke Dec 31, 2024
edce1bf
docs
strengejacke Dec 31, 2024
1f9b8b7
tests
strengejacke Dec 31, 2024
475117e
add tests
strengejacke Dec 31, 2024
227c99b
typo
strengejacke Dec 31, 2024
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.13.0.21
Version: 0.13.0.22
Authors@R: c(
person("Indrajeet", "Patil", , "patilindrajeet.science@gmail.com", role = "aut",
comment = c(ORCID = "0000-0003-1995-6531")),
Expand Down
12 changes: 11 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,29 @@ BREAKING CHANGES AND DEPRECATIONS
- if `select` (previously `pattern`) is a named vector, then all elements
must be named, e.g. `c(length = "Sepal.Length", "Sepal.Width")` errors.

* Order of arguments `by` and `probability_weights` in `rescale_weights()` has
changed, because for `method = "kish"`, the `by` argument is optional.

* The name of the rescaled weights variables in `rescale_weights()` have been
renamed. `pweights_a` and `pweights_b` are now named `rescaled_weights_a`
and `rescaled_weights_b`.

* `print()` methods for `data_tabulate()` with multiple sub-tables (i.e. when
length of `by` was > 1) were revised. Now, an integrated table instead of
multiple tables is returned. Furthermore, `print_html()` did not work, which
was also fixed now.

* `demean()` (and `degroup()`) gets an `append` argument that defaults to `TRUE`,
to append the centered variabled to the original data frame, instead of
to append the centered variables to the original data frame, instead of
returning the de- and group-meaned variables only. Use `append = FALSE` to
for the previous default behaviour (i.e. only returning the newly created
variables).

CHANGES

* `rescale_weights()` gets a `method` argument, to choose method to rescale
weights. Options are `"carle"` (the default) and `"kish"`.

* The `select` argument, which is available in different functions to select
variables, can now also be a character vector with quoted variable names,
including a colon to indicate a range of several variables (e.g. `"cyl:gear"`).
Expand Down
2 changes: 1 addition & 1 deletion R/data_arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data_arrange.default <- function(data, select = NULL, safe = TRUE) {
select <- gsub("^-", "", select)

# check for variables that are not in data
dont_exist <- select[which(!select %in% names(data))]
dont_exist <- setdiff(select, colnames(data))

if (length(dont_exist) > 0) {
if (safe) {
Expand Down
Loading
Loading