Skip to content

Commit

Permalink
Release 0.13.0 (#546)
Browse files Browse the repository at this point in the history
* Increment version number to 0.13.0

* fix description, remove othe cran comments

* remove deprecated functions and arguments

* forgot to remove one arg

* styler

* update news

* update news

* add correct snapshot test

* requires insight 0.20.5

---------

Co-authored-by: etiennebacher <[email protected]>
Co-authored-by: Daniel <[email protected]>
  • Loading branch information
3 people authored Oct 6, 2024
1 parent 41aec02 commit c4f3f29
Show file tree
Hide file tree
Showing 29 changed files with 40 additions and 337 deletions.
5 changes: 2 additions & 3 deletions 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.12.3.4
Version: 0.13.0
Authors@R: c(
person("Indrajeet", "Patil", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-1995-6531")),
Expand Down Expand Up @@ -33,7 +33,7 @@ BugReports: https://github.com/easystats/datawizard/issues
Depends:
R (>= 3.6)
Imports:
insight (>= 0.20.4),
insight (>= 0.20.5),
stats,
utils
Suggests:
Expand Down Expand Up @@ -76,4 +76,3 @@ RoxygenNote: 7.3.2
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/Needs/website: easystats/easystatstemplate
Remotes: easystats/insight
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export(assign_labels)
export(categorize)
export(center)
export(centre)
export(change_code)
export(change_scale)
export(coef_var)
export(coerce_to_numeric)
Expand All @@ -237,7 +236,6 @@ export(data_codebook)
export(data_duplicated)
export(data_extract)
export(data_filter)
export(data_find)
export(data_group)
export(data_join)
export(data_match)
Expand Down Expand Up @@ -276,8 +274,6 @@ export(empty_columns)
export(empty_rows)
export(extract_column_names)
export(find_columns)
export(format_text)
export(get_columns)
export(kurtosis)
export(labels_to_levels)
export(mean_sd)
Expand Down
16 changes: 15 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
# datawizard (development)
# datawizard 0.13.0

BREAKING CHANGES

* `data_rename()` now errors when the `replacement` argument contains `NA` values
or empty strings (#539).

* Removed deprecated functions `get_columns()`, `data_find()`, `format_text()` (#546).

* Removed deprecated arguments `group` and `na.rm` in multiple functions. Use `by` and `remove_na` instead (#546).

* The default value for the argument `dummy_factors` in `to_numeric()` has
changed from `TRUE` to `FALSE` (#544).

CHANGES

* The `pattern` argument in `data_rename()` can also be a named vector. In this
case, names are used as values for the `replacement` argument (i.e. `pattern`
can be a character vector using `<new name> = "<old name>"`).

* `categorize()` gains a new `breaks` argument, to decide whether breaks are
inclusive or exclusive (#548).

* The `labels` argument in `categorize()` gets two new options, `"range"` and
`"observed"`, to use the range of categorized values as labels (i.e. factor
levels) (#548).

* Minor additions to `reshape_ci()` to work with forthcoming changes in the
`{bayestestR}` package.

Expand Down
8 changes: 0 additions & 8 deletions R/data_partition.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#' @param row_id Character string, indicating the name of the column that
#' contains the row-id's.
#' @param verbose Toggle messages and warnings.
#' @param group Deprecated. Use `by` instead.
#'
#' @return A list of data frames. The list includes one training set per given
#' proportion and the remaining data as test set. List elements of training
Expand Down Expand Up @@ -50,17 +49,10 @@ data_partition <- function(data,
seed = NULL,
row_id = ".row_id",
verbose = TRUE,
group = NULL,
...) {
# validation checks
data <- .coerce_to_dataframe(data)

## TODO: remove warning in future release
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

if (sum(proportion) > 1) {
insight::format_error("Sum of `proportion` cannot be higher than 1.")
}
Expand Down
22 changes: 0 additions & 22 deletions R/data_select.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,3 @@ data_select <- function(data,
out <- .replace_attrs(out, a)
out
}


#' @rdname extract_column_names
#' @export
get_columns <- function(data,
select = NULL,
exclude = NULL,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...) {
insight::format_warning("Function `get_columns()` is deprecated and will be removed in a future release. Please use `data_select()` instead.") # nolint
data_select(
data,
select = select,
exclude = exclude,
ignore_case = ignore_case,
regex = regex,
verbose = verbose,
...
)
}
19 changes: 2 additions & 17 deletions R/demean.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#' attributes to indicate the within- and between-effects. This is only
#' relevant when printing `model_parameters()` - in such cases, the
#' within- and between-effects are printed in separated blocks.
#' @param group Deprecated. Use `by` instead.
#' @inheritParams center
#'
#' @return
Expand Down Expand Up @@ -285,14 +284,7 @@ demean <- function(x,
suffix_demean = "_within",
suffix_groupmean = "_between",
add_attributes = TRUE,
verbose = TRUE,
group = NULL) {
## TODO: remove warning in future release
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

verbose = TRUE) {
degroup(
x = x,
select = select,
Expand All @@ -317,14 +309,7 @@ degroup <- function(x,
suffix_demean = "_within",
suffix_groupmean = "_between",
add_attributes = TRUE,
verbose = TRUE,
group = NULL) {
## TODO: remove warning later
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

verbose = TRUE) {
# ugly tibbles again...
x <- .coerce_to_dataframe(x)

Expand Down
9 changes: 1 addition & 8 deletions R/descriptives.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ coef_var.default <- function(x, verbose = TRUE, ...) {
#' as the nearest endpoint.
#' @param remove_na Logical. Should `NA` values be removed before computing (`TRUE`)
#' or not (`FALSE`, default)?
#' @param na.rm Deprecated. Please use `remove_na` instead.
#' @param n If `method = "unbiased"` and both `mu` and `sigma` are provided (not
#' computed from `x`), what sample size to use to adjust the computed CV
#' for small-sample bias?
Expand Down Expand Up @@ -111,13 +110,7 @@ coef_var.default <- function(x, verbose = TRUE, ...) {
#' @export
coef_var.numeric <- function(x, mu = NULL, sigma = NULL,
method = c("standard", "unbiased", "median_mad", "qcd"),
trim = 0, remove_na = FALSE, n = NULL, na.rm = FALSE, ...) {
# TODO: remove deprecated argument later
if (!missing(na.rm)) {
insight::format_warning("Argument `na.rm` is deprecated. Please use `remove_na` instead.")
remove_na <- na.rm
}

trim = 0, remove_na = FALSE, n = NULL, ...) {
# TODO: Support weights
if (!missing(x) && all(c(-1, 1) %in% sign(x))) {
insight::format_error("Coefficient of variation only applicable for ratio scale variables.")
Expand Down
24 changes: 1 addition & 23 deletions R/extract_column_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,28 +160,6 @@ extract_column_names <- function(data,
columns
}


#' @rdname extract_column_names
#' @export
data_find <- function(data,
select = NULL,
exclude = NULL,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...) {
insight::format_warning("Function `data_find()` is deprecated and will be removed in a future release. Please use `extract_column_names()` instead.") # nolint
extract_column_names(
data,
select = select,
exclude = exclude,
ignore_case = ignore_case,
regex = regex,
verbose = verbose,
...
)
}

#' @rdname extract_column_names
#' @export
find_columns <- data_find
find_columns <- extract_column_names
14 changes: 2 additions & 12 deletions R/mean_sd.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@
#' median_mad(mtcars$mpg)
#'
#' @export
mean_sd <- function(x, times = 1L, remove_na = TRUE, named = TRUE, na.rm = TRUE, ...) {
# TODO: remove deprecated argument later
if (!missing(na.rm)) {
insight::format_warning("Argument `na.rm` is deprecated. Please use `remove_na` instead.")
remove_na <- na.rm
}
mean_sd <- function(x, times = 1L, remove_na = TRUE, named = TRUE, ...) {
.centrality_dispersion(x, type = "mean", times = times, remove_na = remove_na, named = named)
}

#' @export
#' @rdname mean_sd
median_mad <- function(x, times = 1L, remove_na = TRUE, constant = 1.4826, named = TRUE, na.rm = TRUE, ...) {
# TODO: remove deprecated argument later
if (!missing(na.rm)) {
insight::format_warning("Argument `na.rm` is deprecated. Please use `remove_na` instead.")
remove_na <- na.rm
}
median_mad <- function(x, times = 1L, remove_na = TRUE, constant = 1.4826, named = TRUE, ...) {
.centrality_dispersion(x, type = "median", times = times, remove_na = remove_na, constant = constant, named = named)
}

Expand Down
15 changes: 0 additions & 15 deletions R/means_by_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#' @param digits Optional scalar, indicating the amount of digits after decimal
#' point when rounding estimates and values.
#' @param ... Currently not used
#' @param group Deprecated. Use `by` instead.
#' @inheritParams find_columns
#'
#' @return A data frame with information on mean and further summary statistics
Expand Down Expand Up @@ -60,14 +59,7 @@ means_by_group.numeric <- function(x,
ci = 0.95,
weights = NULL,
digits = NULL,
group = NULL,
...) {
## TODO: remove warning in future release
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

# validation check for arguments

# "by" must be provided
Expand Down Expand Up @@ -139,14 +131,7 @@ means_by_group.data.frame <- function(x,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
group = NULL,
...) {
## TODO: remove warning in future release
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

# evaluate select/exclude, may be select-helpers
select <- .select_nse(select,
x,
Expand Down
32 changes: 0 additions & 32 deletions R/recode_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,35 +527,3 @@ recode_values.data.frame <- function(x,

ok
}


## TODO Deprecate and remove alias later

#' @rdname recode_values
#' @export
change_code <- function(x,
select = NULL,
exclude = NULL,
recode = NULL,
default = NULL,
preserve_na = TRUE,
append = FALSE,
ignore_case = FALSE,
regex = FALSE,
verbose = TRUE,
...) {
insight::format_warning("Function `change_code()` is deprecated. Please use `recode_values()` instead.") # nolint
recode_values(
x,
select = select,
exclude = exclude,
recode = recode,
default = default,
preserve_na = preserve_na,
append = append,
ignore_case = ignore_case,
regex = regex,
verbose = verbose,
...
)
}
9 changes: 1 addition & 8 deletions R/rescale_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#' @param nest Logical, if `TRUE` and `by` indicates at least two
#' group variables, then groups are "nested", i.e. groups are now a
#' combination from each group level of the variables in `by`.
#' @param group Deprecated. Use `by` instead.
#'
#' @return `data`, including the new weighting variables: `pweights_a`
#' and `pweights_b`, which represent the rescaled design weights to use
Expand Down Expand Up @@ -88,13 +87,7 @@
#' )
#' }
#' @export
rescale_weights <- function(data, by, probability_weights, nest = FALSE, group = NULL) {
## TODO: remove warning in future release
if (!is.null(group)) {
by <- group
insight::format_warning("Argument `group` is deprecated and will be removed in a future release. Please use `by` instead.") # nolint
}

rescale_weights <- function(data, by, probability_weights, nest = FALSE) {
if (inherits(by, "formula")) {
by <- all.vars(by)
}
Expand Down
Loading

0 comments on commit c4f3f29

Please sign in to comment.