From 132b0c8b089dd6936cc087ff9a2854e699d59e19 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 2 Oct 2024 12:21:48 +0200 Subject: [PATCH 1/9] Increment version number to 0.13.0 --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3d1a0081a..1fdbeab1f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", , "patilindrajeet.science@gmail.com", role = "aut", comment = c(ORCID = "0000-0003-1995-6531")), diff --git a/NEWS.md b/NEWS.md index 8e329b0fb..807591c01 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# datawizard 0.13.0 + # datawizard (development) BREAKING CHANGES From e366fd39be1d637399276e1e2d2802d450b48909 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 2 Oct 2024 12:25:14 +0200 Subject: [PATCH 2/9] fix description, remove othe cran comments --- DESCRIPTION | 3 +-- NEWS.md | 2 -- cran-comments.md | 7 ------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1fdbeab1f..0ea4a6268 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -75,5 +75,4 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 Config/testthat/edition: 3 Config/testthat/parallel: true -Config/Needs/website: easystats/easystatstemplate -Remotes: easystats/insight +Config/Needs/website: easystats/easystatstemplate \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index 807591c01..d91f0e71d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,5 @@ # datawizard 0.13.0 -# datawizard (development) - BREAKING CHANGES * `data_rename()` now errors when the `replacement` argument contains `NA` values diff --git a/cran-comments.md b/cran-comments.md index 2c30d1287..095f22e9a 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -9,10 +9,3 @@ We checked 18 reverse dependencies, comparing R CMD check results across CRAN an * We saw 0 new problems * We failed to check 0 packages -## Other comments - -This is a patch release that should (hopefully) fix a failure occurring on macOS -when building vignettes. This only happens on macOS with R 4.3. We tried to -reproduce this locally and in CI with the same setup, but we couldn't. Hence, we -removed all vignettes (except for one "Overview"), they are now only available -on the website. From 872550d3297882ebca410743e47589113db61c07 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 2 Oct 2024 14:24:26 +0200 Subject: [PATCH 3/9] remove deprecated functions and arguments --- DESCRIPTION | 2 +- NAMESPACE | 4 --- NEWS.md | 4 +++ R/data_partition.R | 7 ---- R/data_select.R | 22 ------------- R/demean.R | 19 ++--------- R/descriptives.R | 8 +---- R/extract_column_names.R | 24 +------------- R/mean_sd.R | 14 ++------ R/means_by_group.R | 17 +--------- R/recode_values.R | 34 +------------------ R/rescale_weights.R | 9 +---- R/skewness_kurtosis.R | 60 ---------------------------------- R/text_format.R | 9 ----- man/coef_var.Rd | 3 -- man/data_partition.Rd | 2 -- man/datawizard-package.Rd | 10 +++--- man/demean.Rd | 11 ++----- man/extract_column_names.Rd | 22 ------------- man/mean_sd.Rd | 5 +-- man/means_by_group.Rd | 13 +------- man/recode_values.Rd | 15 --------- man/rescale_weights.Rd | 4 +-- man/skewness.Rd | 4 --- man/text_format.Rd | 10 ------ tests/testthat/test-coef_var.R | 4 --- tests/testthat/test-mean_sd.R | 5 --- 27 files changed, 25 insertions(+), 316 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0ea4a6268..c99e19683 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -75,4 +75,4 @@ Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 Config/testthat/edition: 3 Config/testthat/parallel: true -Config/Needs/website: easystats/easystatstemplate \ No newline at end of file +Config/Needs/website: easystats/easystatstemplate diff --git a/NAMESPACE b/NAMESPACE index a08798db1..c435c0cc5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) @@ -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) @@ -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) diff --git a/NEWS.md b/NEWS.md index d91f0e71d..97425d031 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,10 @@ 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). + CHANGES * The `pattern` argument in `data_rename()` can also be a named vector. In this diff --git a/R/data_partition.R b/R/data_partition.R index 09add9dd7..2cfbc0169 100644 --- a/R/data_partition.R +++ b/R/data_partition.R @@ -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 @@ -55,12 +54,6 @@ data_partition <- function(data, # 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.") } diff --git a/R/data_select.R b/R/data_select.R index 0f62ba398..db91fc06b 100644 --- a/R/data_select.R +++ b/R/data_select.R @@ -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, - ... - ) -} diff --git a/R/demean.R b/R/demean.R index 94bfc255f..b5363edb6 100644 --- a/R/demean.R +++ b/R/demean.R @@ -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 @@ -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, @@ -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) diff --git a/R/descriptives.R b/R/descriptives.R index 097934d29..66b85817f 100644 --- a/R/descriptives.R +++ b/R/descriptives.R @@ -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? @@ -111,12 +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))) { diff --git a/R/extract_column_names.R b/R/extract_column_names.R index b89173a8c..c245f4bab 100644 --- a/R/extract_column_names.R +++ b/R/extract_column_names.R @@ -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 diff --git a/R/mean_sd.R b/R/mean_sd.R index d18473d8d..42ce9b523 100644 --- a/R/mean_sd.R +++ b/R/mean_sd.R @@ -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) } diff --git a/R/means_by_group.R b/R/means_by_group.R index ad188f275..b8d39b996 100644 --- a/R/means_by_group.R +++ b/R/means_by_group.R @@ -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 @@ -60,15 +59,8 @@ 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 + # validation check for arguments # "by" must be provided if (is.null(by)) { @@ -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, diff --git a/R/recode_values.R b/R/recode_values.R index b4570bf44..eff1ff3ea 100644 --- a/R/recode_values.R +++ b/R/recode_values.R @@ -526,36 +526,4 @@ 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, - ... - ) -} +} \ No newline at end of file diff --git a/R/rescale_weights.R b/R/rescale_weights.R index 02aab1d2e..60d405c9d 100644 --- a/R/rescale_weights.R +++ b/R/rescale_weights.R @@ -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 @@ -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) } diff --git a/R/skewness_kurtosis.R b/R/skewness_kurtosis.R index 6142c59ad..3586448ef 100644 --- a/R/skewness_kurtosis.R +++ b/R/skewness_kurtosis.R @@ -110,14 +110,7 @@ skewness.numeric <- function(x, type = "2", iterations = NULL, verbose = TRUE, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } if (remove_na) x <- x[!is.na(x)] n <- length(x) @@ -177,14 +170,7 @@ skewness.matrix <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } .skewness <- apply( x, @@ -213,15 +199,7 @@ skewness.data.frame <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } - .skewness <- lapply(x, skewness, remove_na = remove_na, @@ -241,14 +219,7 @@ skewness.default <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } skewness( .factor_to_numeric(x), @@ -277,15 +248,7 @@ kurtosis.numeric <- function(x, type = "2", iterations = NULL, verbose = TRUE, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } - if (remove_na) x <- x[!is.na(x)] n <- length(x) out <- n * sum((x - mean(x))^4) / (sum((x - mean(x))^2)^2) @@ -342,15 +305,7 @@ kurtosis.matrix <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } - .kurtosis <- apply( x, 2, @@ -374,15 +329,7 @@ kurtosis.data.frame <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } - .kurtosis <- lapply(x, kurtosis, remove_na = remove_na, @@ -400,14 +347,7 @@ kurtosis.default <- function(x, remove_na = TRUE, type = "2", iterations = NULL, - na.rm = TRUE, ...) { - # TODO: remove deprecated argument later - if (!missing(na.rm)) { - # TODO: add deprecation warning in a later update - insight::format_warning("Argument `na.rm` is deprecated and will be removed in a future release. Please use `remove_na` instead.") # nolint - remove_na <- na.rm - } kurtosis( .factor_to_numeric(x), diff --git a/R/text_format.R b/R/text_format.R index afdf4f861..0fa75bcac 100644 --- a/R/text_format.R +++ b/R/text_format.R @@ -42,15 +42,6 @@ text_format <- function(text, sep = ", ", last = " and ", width = NULL, enclose text_wrap(text_concatenate(text, sep = sep, last = last, enclose = enclose), width = width) } -## TODO Deprecate and remove alias later - -#' @rdname text_format -#' @export -format_text <- function(text, sep = ", ", last = " and ", width = NULL, enclose = NULL, ...) { - insight::format_warning("Function `format_text()` is deprecated and will be removed in a future release. Please use `text_format()` instead.") # nolint - text_format(text, sep = sep, last = last, width = width, enclose = enclose, ...) -} - #' @rdname text_format #' @export text_fullstop <- function(text) { diff --git a/man/coef_var.Rd b/man/coef_var.Rd index 92274ca59..2ff973838 100644 --- a/man/coef_var.Rd +++ b/man/coef_var.Rd @@ -19,7 +19,6 @@ distribution_coef_var(x, ...) trim = 0, remove_na = FALSE, n = NULL, - na.rm = FALSE, ... ) } @@ -52,8 +51,6 @@ or not (\code{FALSE}, default)?} \item{n}{If \code{method = "unbiased"} and both \code{mu} and \code{sigma} are provided (not computed from \code{x}), what sample size to use to adjust the computed CV for small-sample bias?} - -\item{na.rm}{Deprecated. Please use \code{remove_na} instead.} } \value{ The computed coefficient of variation for \code{x}. diff --git a/man/data_partition.Rd b/man/data_partition.Rd index 68ac05a19..2ee170981 100644 --- a/man/data_partition.Rd +++ b/man/data_partition.Rd @@ -33,8 +33,6 @@ contains the row-id's.} \item{verbose}{Toggle messages and warnings.} -\item{group}{Deprecated. Use \code{by} instead.} - \item{...}{Other arguments passed to or from other functions.} } \value{ diff --git a/man/datawizard-package.Rd b/man/datawizard-package.Rd index db38bc334..d389df6ac 100644 --- a/man/datawizard-package.Rd +++ b/man/datawizard-package.Rd @@ -33,16 +33,16 @@ Useful links: Authors: \itemize{ - \item Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) (@patilindrajeets) - \item Dominique Makowski \email{dom.makowski@gmail.com} (\href{https://orcid.org/0000-0001-5375-9967}{ORCID}) (@Dom_Makowski) - \item Daniel Lüdecke \email{d.luedecke@uke.de} (\href{https://orcid.org/0000-0002-8895-3206}{ORCID}) (@strengejacke) + \item Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) + \item Dominique Makowski \email{dom.makowski@gmail.com} (\href{https://orcid.org/0000-0001-5375-9967}{ORCID}) + \item Daniel Lüdecke \email{d.luedecke@uke.de} (\href{https://orcid.org/0000-0002-8895-3206}{ORCID}) \item Mattan S. Ben-Shachar \email{matanshm@post.bgu.ac.il} (\href{https://orcid.org/0000-0002-4287-4801}{ORCID}) - \item Brenton M. Wiernik \email{brenton@wiernik.org} (\href{https://orcid.org/0000-0001-9560-6336}{ORCID}) (@bmwiernik) + \item Brenton M. Wiernik \email{brenton@wiernik.org} (\href{https://orcid.org/0000-0001-9560-6336}{ORCID}) } Other contributors: \itemize{ - \item Rémi Thériault \email{remi.theriault@mail.mcgill.ca} (\href{https://orcid.org/0000-0003-4315-6788}{ORCID}) (@rempsyc) [contributor] + \item Rémi Thériault \email{remi.theriault@mail.mcgill.ca} (\href{https://orcid.org/0000-0003-4315-6788}{ORCID}) [contributor] \item Thomas J. Faulkenberry \email{faulkenberry@tarleton.edu} [reviewer] \item Robert Garrett \email{rcg4@illinois.edu} [reviewer] } diff --git a/man/demean.Rd b/man/demean.Rd index 8a9a49308..fb4db3a29 100644 --- a/man/demean.Rd +++ b/man/demean.Rd @@ -14,8 +14,7 @@ demean( suffix_demean = "_within", suffix_groupmean = "_between", add_attributes = TRUE, - verbose = TRUE, - group = NULL + verbose = TRUE ) degroup( @@ -27,8 +26,7 @@ degroup( suffix_demean = "_within", suffix_groupmean = "_between", add_attributes = TRUE, - verbose = TRUE, - group = NULL + verbose = TRUE ) detrend( @@ -40,8 +38,7 @@ detrend( suffix_demean = "_within", suffix_groupmean = "_between", add_attributes = TRUE, - verbose = TRUE, - group = NULL + verbose = TRUE ) } \arguments{ @@ -86,8 +83,6 @@ within- and between-effects are printed in separated blocks.} \item{verbose}{Toggle warnings and messages.} -\item{group}{Deprecated. Use \code{by} instead.} - \item{center}{Method for centering. \code{demean()} always performs mean-centering, while \code{degroup()} can use \code{center = "median"} or \code{center = "mode"} for median- or mode-centering, and also \code{"min"} diff --git a/man/extract_column_names.Rd b/man/extract_column_names.Rd index 6805d9569..6e658ab33 100644 --- a/man/extract_column_names.Rd +++ b/man/extract_column_names.Rd @@ -2,9 +2,7 @@ % Please edit documentation in R/data_select.R, R/extract_column_names.R \name{data_select} \alias{data_select} -\alias{get_columns} \alias{extract_column_names} -\alias{data_find} \alias{find_columns} \title{Find or get columns in a data frame based on search patterns} \usage{ @@ -18,16 +16,6 @@ data_select( ... ) -get_columns( - data, - select = NULL, - exclude = NULL, - ignore_case = FALSE, - regex = FALSE, - verbose = TRUE, - ... -) - extract_column_names( data, select = NULL, @@ -38,16 +26,6 @@ extract_column_names( ... ) -data_find( - data, - select = NULL, - exclude = NULL, - ignore_case = FALSE, - regex = FALSE, - verbose = TRUE, - ... -) - find_columns( data, select = NULL, diff --git a/man/mean_sd.Rd b/man/mean_sd.Rd index f0ea239f8..33eeb4bc5 100644 --- a/man/mean_sd.Rd +++ b/man/mean_sd.Rd @@ -5,7 +5,7 @@ \alias{median_mad} \title{Summary Helpers} \usage{ -mean_sd(x, times = 1L, remove_na = TRUE, named = TRUE, na.rm = TRUE, ...) +mean_sd(x, times = 1L, remove_na = TRUE, named = TRUE, ...) median_mad( x, @@ -13,7 +13,6 @@ median_mad( remove_na = TRUE, constant = 1.4826, named = TRUE, - na.rm = TRUE, ... ) } @@ -29,8 +28,6 @@ or not (\code{FALSE}, default)?} \item{named}{Should the vector be named? (E.g., \code{c("-SD" = -1, Mean = 1, "+SD" = 2)}.)} -\item{na.rm}{Deprecated. Please use \code{remove_na} instead.} - \item{...}{Not used.} \item{constant}{scale factor.} diff --git a/man/means_by_group.Rd b/man/means_by_group.Rd index d7a6dfc96..ba2a7d0c8 100644 --- a/man/means_by_group.Rd +++ b/man/means_by_group.Rd @@ -8,15 +8,7 @@ \usage{ means_by_group(x, ...) -\method{means_by_group}{numeric}( - x, - by = NULL, - ci = 0.95, - weights = NULL, - digits = NULL, - group = NULL, - ... -) +\method{means_by_group}{numeric}(x, by = NULL, ci = 0.95, weights = NULL, digits = NULL, ...) \method{means_by_group}{data.frame}( x, @@ -29,7 +21,6 @@ means_by_group(x, ...) ignore_case = FALSE, regex = FALSE, verbose = TRUE, - group = NULL, ... ) } @@ -56,8 +47,6 @@ weights are used.} \item{digits}{Optional scalar, indicating the amount of digits after decimal point when rounding estimates and values.} -\item{group}{Deprecated. Use \code{by} instead.} - \item{select}{Variables that will be included when performing the required tasks. Can be either \itemize{ diff --git a/man/recode_values.Rd b/man/recode_values.Rd index 9810c0a2d..baa7afda9 100644 --- a/man/recode_values.Rd +++ b/man/recode_values.Rd @@ -4,7 +4,6 @@ \alias{recode_values} \alias{recode_values.numeric} \alias{recode_values.data.frame} -\alias{change_code} \title{Recode old values of variables into new values} \usage{ recode_values(x, ...) @@ -31,20 +30,6 @@ recode_values(x, ...) verbose = TRUE, ... ) - -change_code( - x, - select = NULL, - exclude = NULL, - recode = NULL, - default = NULL, - preserve_na = TRUE, - append = FALSE, - ignore_case = FALSE, - regex = FALSE, - verbose = TRUE, - ... -) } \arguments{ \item{x}{A data frame, numeric or character vector, or factor.} diff --git a/man/rescale_weights.Rd b/man/rescale_weights.Rd index 4a67d4100..d9651decb 100644 --- a/man/rescale_weights.Rd +++ b/man/rescale_weights.Rd @@ -4,7 +4,7 @@ \alias{rescale_weights} \title{Rescale design weights for multilevel analysis} \usage{ -rescale_weights(data, by, probability_weights, nest = FALSE, group = NULL) +rescale_weights(data, by, probability_weights, nest = FALSE) } \arguments{ \item{data}{A data frame.} @@ -21,8 +21,6 @@ sampling) weights of the survey data (level-1-weight).} \item{nest}{Logical, if \code{TRUE} and \code{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 \code{by}.} - -\item{group}{Deprecated. Use \code{by} instead.} } \value{ \code{data}, including the new weighting variables: \code{pweights_a} diff --git a/man/skewness.Rd b/man/skewness.Rd index a89d98067..0401e3a40 100644 --- a/man/skewness.Rd +++ b/man/skewness.Rd @@ -19,7 +19,6 @@ skewness(x, ...) type = "2", iterations = NULL, verbose = TRUE, - na.rm = TRUE, ... ) @@ -31,7 +30,6 @@ kurtosis(x, ...) type = "2", iterations = NULL, verbose = TRUE, - na.rm = TRUE, ... ) @@ -61,8 +59,6 @@ errors. If \code{NULL} (default), parametric standard errors are computed.} \item{verbose}{Toggle warnings and messages.} -\item{na.rm}{Deprecated. Please use \code{remove_na} instead.} - \item{digits}{Number of decimal places.} \item{test}{Logical, if \code{TRUE}, tests if skewness or kurtosis is diff --git a/man/text_format.Rd b/man/text_format.Rd index 5f246731f..14d64b096 100644 --- a/man/text_format.Rd +++ b/man/text_format.Rd @@ -2,7 +2,6 @@ % Please edit documentation in R/text_format.R \name{text_format} \alias{text_format} -\alias{format_text} \alias{text_fullstop} \alias{text_lastchar} \alias{text_concatenate} @@ -20,15 +19,6 @@ text_format( ... ) -format_text( - text, - sep = ", ", - last = " and ", - width = NULL, - enclose = NULL, - ... -) - text_fullstop(text) text_lastchar(text, n = 1) diff --git a/tests/testthat/test-coef_var.R b/tests/testthat/test-coef_var.R index a55eb7b96..2ae2275cd 100644 --- a/tests/testthat/test-coef_var.R +++ b/tests/testthat/test-coef_var.R @@ -29,10 +29,6 @@ test_that("coef_var: argument 'remove_na' works", { ) }) -test_that("coef_var: deprecation warning", { - expect_warning(coef_var(c(1:10, NA), na.rm = TRUE)) -}) - test_that("coef_var: method 'unbiased' needs argument 'n' when sigma and mu are provided", { expect_error( coef_var(1:10, method = "unbiased", mu = 10, sigma = 20), diff --git a/tests/testthat/test-mean_sd.R b/tests/testthat/test-mean_sd.R index e0af8a0f1..3e0829fb1 100644 --- a/tests/testthat/test-mean_sd.R +++ b/tests/testthat/test-mean_sd.R @@ -15,8 +15,3 @@ test_that("mean_sd", { expect_equal(unname(diff(msd2)), rep(sd(mtcars[["mpg"]]), 6), tolerance = 0.00001) expect_named(msd2, c("-3 SD", "-2 SD", "-1 SD", "Mean", "+1 SD", "+2 SD", "+3 SD")) }) - -test_that("deprecation warning for `na.rm`", { - expect_warning(mean_sd(c(-1, 0, 1, NA), na.rm = TRUE)) - expect_warning(median_mad(c(-1, 0, 1, 2, 3, NA), na.rm = TRUE)) -}) From 34f292aaf1337f7f6cf97beb1732fa9c13105bbf Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 2 Oct 2024 14:26:11 +0200 Subject: [PATCH 4/9] forgot to remove one arg --- R/data_partition.R | 1 - man/data_partition.Rd | 1 - 2 files changed, 2 deletions(-) diff --git a/R/data_partition.R b/R/data_partition.R index 2cfbc0169..99f481e18 100644 --- a/R/data_partition.R +++ b/R/data_partition.R @@ -49,7 +49,6 @@ data_partition <- function(data, seed = NULL, row_id = ".row_id", verbose = TRUE, - group = NULL, ...) { # validation checks data <- .coerce_to_dataframe(data) diff --git a/man/data_partition.Rd b/man/data_partition.Rd index 2ee170981..1150b4f28 100644 --- a/man/data_partition.Rd +++ b/man/data_partition.Rd @@ -11,7 +11,6 @@ data_partition( seed = NULL, row_id = ".row_id", verbose = TRUE, - group = NULL, ... ) } From 1ae48bca5e6976c4d2bf4b4d51f3a3fcab7c558c Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 2 Oct 2024 14:41:32 +0200 Subject: [PATCH 5/9] styler --- R/descriptives.R | 1 - R/means_by_group.R | 2 +- R/recode_values.R | 2 +- R/skewness_kurtosis.R | 4 ---- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/R/descriptives.R b/R/descriptives.R index 66b85817f..43479f697 100644 --- a/R/descriptives.R +++ b/R/descriptives.R @@ -111,7 +111,6 @@ coef_var.default <- function(x, verbose = TRUE, ...) { coef_var.numeric <- function(x, mu = NULL, sigma = NULL, method = c("standard", "unbiased", "median_mad", "qcd"), 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.") diff --git a/R/means_by_group.R b/R/means_by_group.R index b8d39b996..39416bb11 100644 --- a/R/means_by_group.R +++ b/R/means_by_group.R @@ -60,7 +60,7 @@ means_by_group.numeric <- function(x, weights = NULL, digits = NULL, ...) { - # validation check for arguments + # validation check for arguments # "by" must be provided if (is.null(by)) { diff --git a/R/recode_values.R b/R/recode_values.R index eff1ff3ea..a8e8d6d3b 100644 --- a/R/recode_values.R +++ b/R/recode_values.R @@ -526,4 +526,4 @@ recode_values.data.frame <- function(x, } ok -} \ No newline at end of file +} diff --git a/R/skewness_kurtosis.R b/R/skewness_kurtosis.R index 3586448ef..23ced0a04 100644 --- a/R/skewness_kurtosis.R +++ b/R/skewness_kurtosis.R @@ -111,7 +111,6 @@ skewness.numeric <- function(x, iterations = NULL, verbose = TRUE, ...) { - if (remove_na) x <- x[!is.na(x)] n <- length(x) out <- (sum((x - mean(x))^3) / n) / (sum((x - mean(x))^2) / n)^1.5 @@ -171,7 +170,6 @@ skewness.matrix <- function(x, type = "2", iterations = NULL, ...) { - .skewness <- apply( x, 2, @@ -220,7 +218,6 @@ skewness.default <- function(x, type = "2", iterations = NULL, ...) { - skewness( .factor_to_numeric(x), remove_na = remove_na, @@ -348,7 +345,6 @@ kurtosis.default <- function(x, type = "2", iterations = NULL, ...) { - kurtosis( .factor_to_numeric(x), remove_na = remove_na, From 17b34f9dd40dc3bbd8fe8ff7f21c638141c481ac Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 2 Oct 2024 16:37:58 +0200 Subject: [PATCH 6/9] update news --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 97425d031..202d45425 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,9 @@ BREAKING CHANGES * 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 From 4914b96fd10aed63edecf14d4b814382e108a30f Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 2 Oct 2024 17:58:20 +0200 Subject: [PATCH 7/9] update news --- NEWS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS.md b/NEWS.md index 202d45425..f2ade5883 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,13 @@ CHANGES case, names are used as values for the `replacement` argument (i.e. `pattern` can be a character vector using ` = ""`). +* `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. From be756b644b5431bf85c969ff69dac4ac4be7cf6a Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 2 Oct 2024 18:09:56 +0200 Subject: [PATCH 8/9] add correct snapshot test --- tests/testthat/_snaps/categorize.md | 19 +++++++++---------- tests/testthat/test-categorize.R | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/testthat/_snaps/categorize.md b/tests/testthat/_snaps/categorize.md index d08c14c4d..9ed3c1115 100644 --- a/tests/testthat/_snaps/categorize.md +++ b/tests/testthat/_snaps/categorize.md @@ -31,17 +31,16 @@ [31] (10.4-15) (21-24.4) Levels: (10.4-15) (15.2-19.7) (21-24.4) (26-27.3) (30.4-33.9) ---- +# categorize breaks Code - categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "observed", - breaks = "inclusive") + categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "range", breaks = "inclusive") Output - [1] (21-24.4) (21-24.4) (21-24.4) (21-24.4) (15.2-19.7) (15.2-19.7) - [7] (10.4-15) (21-24.4) (21-24.4) (15.2-19.7) (15.2-19.7) (15.2-19.7) - [13] (15.2-19.7) (15.2-19.7) (10.4-15) (10.4-15) (10.4-15) (30.4-33.9) - [19] (30.4-33.9) (30.4-33.9) (21-24.4) (15.2-19.7) (15.2-19.7) (10.4-15) - [25] (15.2-19.7) (26-27.3) (26-27.3) (30.4-33.9) (15.2-19.7) (15.2-19.7) - [31] (10.4-15) (21-24.4) - Levels: (10.4-15) (15.2-19.7) (21-24.4) (26-27.3) (30.4-33.9) + [1] (19.8,24.5] (19.8,24.5] (19.8,24.5] (19.8,24.5] (15.1,19.8] (15.1,19.8] + [7] [10.4,15.1] (19.8,24.5] (19.8,24.5] (15.1,19.8] (15.1,19.8] (15.1,19.8] + [13] (15.1,19.8] (15.1,19.8] [10.4,15.1] [10.4,15.1] [10.4,15.1] (29.2,33.9] + [19] (29.2,33.9] (29.2,33.9] (19.8,24.5] (15.1,19.8] (15.1,19.8] [10.4,15.1] + [25] (15.1,19.8] (24.5,29.2] (24.5,29.2] (29.2,33.9] (15.1,19.8] (15.1,19.8] + [31] [10.4,15.1] (19.8,24.5] + Levels: [10.4,15.1] (15.1,19.8] (19.8,24.5] (24.5,29.2] (29.2,33.9] diff --git a/tests/testthat/test-categorize.R b/tests/testthat/test-categorize.R index 217797893..30453d9ad 100644 --- a/tests/testthat/test-categorize.R +++ b/tests/testthat/test-categorize.R @@ -244,7 +244,7 @@ test_that("categorize labelling ranged", { test_that("categorize breaks", { data(mtcars) - expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "observed", breaks = "inclusive")) + expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "range", breaks = "inclusive")) expect_error( categorize(mtcars$mpg, "equal_length", n_groups = 5, breaks = "something"), regex = "should be one of" From f090bdee13fd6842785d5fbbe12f915ff5656e16 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Thu, 3 Oct 2024 10:23:18 +0200 Subject: [PATCH 9/9] requires insight 0.20.5 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index c99e19683..f3e7599af 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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: