Skip to content

Commit

Permalink
Merge branch 'main' into rempsyc/issue454
Browse files Browse the repository at this point in the history
  • Loading branch information
rempsyc authored Dec 17, 2024
2 parents 357dbbc + 60c2fa5 commit 0c25fef
Show file tree
Hide file tree
Showing 104 changed files with 1,135 additions and 736 deletions.
6 changes: 3 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.13.0.13
Version: 0.13.0.19
Authors@R: c(
person("Indrajeet", "Patil", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-1995-6531")),
Expand Down Expand Up @@ -31,9 +31,9 @@ License: MIT + file LICENSE
URL: https://easystats.github.io/datawizard/
BugReports: https://github.com/easystats/datawizard/issues
Depends:
R (>= 3.6)
R (>= 4.0)
Imports:
insight (>= 0.20.5),
insight (>= 1.0.0),
stats,
utils
Suggests:
Expand Down
30 changes: 25 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# datawizard (development)

BREAKING CHANGES
BREAKING CHANGES AND DEPRECATIONS

* *datawizard* now requires R >= 4.0 (#515).

* Argument `drop_na` in `data_match()` is deprecated now. Please use
`remove_na` instead.

* Argument `drop_na` in `data_match()` is deprecated now. Please use `remove_na`
instead.
* In `data_rename()` (#567):
- argument `pattern` is deprecated. Use `select` instead.
- argument `safe` is deprecated. The function now errors when `select`
contains unknown column names.
- when `replacement` is `NULL`, an error is now thrown (previously, column
indices were used as new names).
- if `select` (previously `pattern`) is a named vector, then all elements
must be named, e.g. `c(length = "Sepal.Length", "Sepal.Width")` errors.

NEW FUNCTIONS

Expand All @@ -23,8 +34,17 @@ CHANGES
* `data_read()` no longer shows warning about forthcoming breaking changes
in upstream packages when reading `.RData` files.

* `data_modify()` now recognizes `n()`, for example to create an index for data groups
with `1:n()` (#535).
* `data_modify()` now recognizes `n()`, for example to create an index for data
groups with `1:n()` (#535).

* The `replacement` argument in `data_rename()` now supports glue-styled
tokens (#563).

* `data_summary()` also accepts the results of `bayestestR::ci()` as summary
function (#483).

* `ranktransform()` has a new argument `zeros` to determine how zeros should be
handled when `sign = TRUE` (#573).

BUG FIXES

Expand Down
12 changes: 4 additions & 8 deletions R/adjust.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#'
#' @return A data frame comparable to `data`, with adjusted variables.
#'
#' @examplesIf require("bayestestR", quietly = TRUE) && require("rstanarm", quietly = TRUE) && require("gamm4", quietly = TRUE)
#' @examplesIf all(insight::check_if_installed(c("bayestestR", "rstanarm", "gamm4"), quietly = TRUE))
#' adjusted_all <- adjust(attitude)
#' head(adjusted_all)
#' adjusted_one <- adjust(attitude, effect = "complaints", select = "rating")
Expand All @@ -43,7 +43,7 @@
#' }
#'
#' # Generate data
#' data <- simulate_correlation(n = 100, r = 0.7)
#' data <- bayestestR::simulate_correlation(n = 100, r = 0.7)
#' data$V2 <- (5 * data$V2) + 20 # Add intercept
#'
#' # Adjust
Expand Down Expand Up @@ -75,12 +75,8 @@ adjust <- function(data,
ignore_case = FALSE,
regex = FALSE,
verbose = FALSE) {
if (!all(colnames(data) == make.names(colnames(data), unique = TRUE))) {
insight::format_warning(
"Bad column names (e.g., with spaces) have been detected which might create issues in many functions.",
"Please fix it (you can run `names(mydata) <- make.names(names(mydata))` for a quick fix)."
)
}
# make sure column names are syntactically valid
.check_dataframe_names(data, action = "error")

# check for formula notation, convert to character vector
if (inherits(effect, "formula")) {
Expand Down
1 change: 0 additions & 1 deletion R/categorize.R
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ categorize.grouped_df <- function(x,
}



# tools --------------------

.equal_range <- function(x, range, n_groups, lowest = NULL) {
Expand Down
12 changes: 10 additions & 2 deletions R/data_addprefix.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#' @rdname data_rename
#' Add a prefix or suffix to column names
#'
#' @rdname data_prefix_suffix
#' @inheritParams extract_column_names
#' @param pattern A character string, which will be added as prefix or suffix
#' to the column names.
#' @param ... Other arguments passed to or from other functions.
#'
#' @seealso
#' [data_rename()] for more fine-grained column renaming.
#' @examples
#' # Add prefix / suffix to all columns
#' head(data_addprefix(iris, "NEW_"))
Expand Down Expand Up @@ -29,7 +37,7 @@ data_addprefix <- function(data,
}


#' @rdname data_rename
#' @rdname data_prefix_suffix
#' @export
data_addsuffix <- function(data,
pattern,
Expand Down
2 changes: 0 additions & 2 deletions R/data_arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ data_arrange <- function(data, select = NULL, safe = TRUE) {
}



#' @export
data_arrange.default <- function(data, select = NULL, safe = TRUE) {
if (is.null(select) || length(select) == 0) {
Expand Down Expand Up @@ -100,7 +99,6 @@ data_arrange.default <- function(data, select = NULL, safe = TRUE) {
}



#' @export
data_arrange.grouped_df <- function(data, select = NULL, safe = TRUE) {
grps <- attr(data, "groups", exact = TRUE)
Expand Down
1 change: 0 additions & 1 deletion R/data_match.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ data_match <- function(x,
}



#' @rdname data_match
#' @export
data_filter <- function(x, ...) {
Expand Down
3 changes: 0 additions & 3 deletions R/data_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ data_read <- function(path,
}



# helper -----------------------

.file_ext <- function(x) {
Expand Down Expand Up @@ -156,7 +155,6 @@ data_read <- function(path,
}



# process imported data from SPSS, SAS or Stata -----------------------

.post_process_imported_data <- function(x, convert_factors, verbose) {
Expand Down Expand Up @@ -225,7 +223,6 @@ data_read <- function(path,
}



# read functions -----------------------

.read_spss <- function(path, encoding, convert_factors, verbose, ...) {
Expand Down
1 change: 0 additions & 1 deletion R/data_relocate.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ data_relocate <- function(data,
}



#' @rdname data_relocate
#' @export
data_reorder <- function(data,
Expand Down
Loading

0 comments on commit 0c25fef

Please sign in to comment.