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

Bump required R version to 4.0 #515

Merged
merged 6 commits into from
Dec 14, 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
Expand Up @@ -31,7 +31,7 @@ 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 (>= 1.0.0),
stats,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.

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
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 @@ -106,7 +106,7 @@
match = "and",
return_indices = FALSE,
remove_na = TRUE,
drop_na,

Check warning on line 109 in R/data_match.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/data_match.R,line=109,col=24,[function_argument_linter] Arguments without defaults should come before arguments with defaults. Consider setting the default to NULL and using is.null() instead of using missing()

Check warning on line 109 in R/data_match.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/data_match.R,line=109,col=24,[function_argument_linter] Arguments without defaults should come before arguments with defaults. Consider setting the default to NULL and using is.null() instead of using missing()
...) {
if (!is.data.frame(to)) {
to <- as.data.frame(to)
Expand Down Expand Up @@ -182,7 +182,6 @@
}



#' @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
3 changes: 0 additions & 3 deletions R/data_rescale.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ change_scale <- function(x, ...) {
}



#' @export
rescale.default <- function(x, verbose = TRUE, ...) {
if (isTRUE(verbose)) {
Expand All @@ -94,7 +93,6 @@ rescale.default <- function(x, verbose = TRUE, ...) {
}



#' @rdname rescale
#' @export
rescale.numeric <- function(x,
Expand Down Expand Up @@ -233,7 +231,6 @@ rescale.grouped_df <- function(x,
}



#' @rdname rescale
#' @export
rescale.data.frame <- function(x,
Expand Down
3 changes: 0 additions & 3 deletions R/data_reverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ reverse.numeric <- function(x,
}



#' @export
reverse.factor <- function(x, range = NULL, verbose = TRUE, ...) {
# Warning if all NaNs
Expand Down Expand Up @@ -195,7 +194,6 @@ reverse.factor <- function(x, range = NULL, verbose = TRUE, ...) {
}



#' @export
reverse.grouped_df <- function(x,
select = NULL,
Expand Down Expand Up @@ -254,7 +252,6 @@ reverse.grouped_df <- function(x,
}



#' @rdname reverse
#' @export
reverse.data.frame <- function(x,
Expand Down
2 changes: 0 additions & 2 deletions R/data_tabulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,6 @@ print_md.datawizard_tables <- function(x, big_mark = NULL, ...) {
}




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

.table_header <- function(x, format = "text") {
Expand Down
2 changes: 0 additions & 2 deletions R/data_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ data_write <- function(data,
}




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


Expand Down
2 changes: 0 additions & 2 deletions R/describe_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ describe_distribution.grouped_df <- function(x,
}




# methods ------------------

#' @export
Expand Down
2 changes: 0 additions & 2 deletions R/descriptives.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ coef_var.numeric <- function(x, mu = NULL, sigma = NULL,
}




# descriptives helpers

.drop_na <- function(x) {
Expand Down
1 change: 0 additions & 1 deletion R/normalize.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ normalize <- function(x, ...) {
}



#' @rdname normalize
#' @export
normalize.numeric <- function(x, include_bounds = TRUE, verbose = TRUE, ...) {
Expand Down
5 changes: 0 additions & 5 deletions R/ranktransform.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
}



#' @rdname ranktransform
#' @export
ranktransform.numeric <- function(x,
Expand All @@ -55,7 +54,7 @@
}

if (verbose) {
insight::format_warning(paste0("Variable `", name, "` contains only one unique value and will not be normalized."))

Check warning on line 57 in R/ranktransform.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/ranktransform.R,line=57,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.

Check warning on line 57 in R/ranktransform.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/ranktransform.R,line=57,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 121 characters.
}

return(x)
Expand All @@ -71,7 +70,7 @@
}

if (verbose) {
insight::format_warning(paste0("Variable `", name, "` contains only two different values. Consider converting it to a factor."))

Check warning on line 73 in R/ranktransform.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/ranktransform.R,line=73,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 134 characters.

Check warning on line 73 in R/ranktransform.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/ranktransform.R,line=73,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 134 characters.
}
}

Expand All @@ -89,16 +88,12 @@
}




#' @export
ranktransform.factor <- function(x, ...) {
x
}




#' @export
ranktransform.grouped_df <- function(x,
select = NULL,
Expand Down
4 changes: 0 additions & 4 deletions R/rescale_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ rescale_weights <- function(data, by, probability_weights, nest = FALSE) {
}





# rescale weights, for one or more group variables ----------------------------

.rescale_weights <- function(x, group, probability_weights, n, weight_non_na) {
Expand Down Expand Up @@ -172,7 +169,6 @@ rescale_weights <- function(data, by, probability_weights, nest = FALSE) {
}



# rescale weights, for nested groups ----------------------------

.rescale_weights_nested <- function(x, group, probability_weights, n, weight_non_na) {
Expand Down
11 changes: 6 additions & 5 deletions R/select_nse.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@

# small helper, to avoid duplicated code
.action_if_not_found <- function(
x,
columns,
matches,
verbose,
ifnotfound) {
x,
columns,
matches,
verbose,
ifnotfound
) {
msg <- paste0(
"Following variable(s) were not found: ",
toString(x[is.na(matches)])
Expand Down
2 changes: 0 additions & 2 deletions R/skewness_kurtosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ skewness.default <- function(x,
}



# Kurtosis -----------------------------------


Expand Down Expand Up @@ -432,7 +431,6 @@ summary.parameters_kurtosis <- function(object, test = FALSE, ...) {
}



# bootstrapping -----------------------------------

.boot_skewness <- function(data, indices, remove_na, type) {
Expand Down
4 changes: 0 additions & 4 deletions R/smoothness.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
}

if (method == "cor") {
smooth <- stats::cor(utils::head(x, length(x) - lag), utils::tail(x, length(x) - lag))

Check warning on line 42 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/smoothness.R,line=42,col=5,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.

Check warning on line 42 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/smoothness.R,line=42,col=5,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.
} else {
smooth <- stats::sd(diff(x, lag = lag)) / abs(mean(diff(x, lag = lag)))

Check warning on line 44 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/smoothness.R,line=44,col=5,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.

Check warning on line 44 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/smoothness.R,line=44,col=5,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.
}

if (!is.null(iterations)) {
if (!requireNamespace("boot", quietly = TRUE)) {

Check warning on line 48 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/smoothness.R,line=48,col=9,[if_not_else_linter] Prefer `if (A) x else y` to the less-readable `if (!A) y else x` in a simple if/else statement.

Check warning on line 48 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/smoothness.R,line=48,col=9,[if_not_else_linter] Prefer `if (A) x else y` to the less-readable `if (!A) y else x` in a simple if/else statement.
insight::format_warning("Package 'boot' needed for bootstrapping SEs.")
} else {
results <- boot::boot(
Expand All @@ -56,7 +56,7 @@
lag = lag
)
out_se <- stats::sd(results$t, na.rm = TRUE)
smooth <- data.frame(Smoothness = smooth, SE = out_se)

Check warning on line 59 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/smoothness.R,line=59,col=7,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.

Check warning on line 59 in R/smoothness.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/smoothness.R,line=59,col=7,[object_overwrite_linter] 'smooth' is an exported object from package 'stats'. Avoid re-using such symbols.
}
}

Expand Down Expand Up @@ -100,8 +100,6 @@
}




# bootstrapping -----------------------------------

.boot_smoothness <- function(data, indices, method, lag) {
Expand All @@ -114,8 +112,6 @@
}




# methods -----------------------------------------

#' @export
Expand Down
4 changes: 0 additions & 4 deletions R/standardize.R
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ standardize.data.frame <- function(x,
}



#' @export
standardize.grouped_df <- function(x,
select = NULL,
Expand Down Expand Up @@ -382,9 +381,6 @@ standardize.grouped_df <- function(x,
}





# Datagrid ----------------------------------------------------------------

#' @export
Expand Down
12 changes: 0 additions & 12 deletions R/standardize.models.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
weights = TRUE,
verbose = TRUE,
include_response = TRUE,
update_expr,

Check warning on line 107 in R/standardize.models.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/standardize.models.R,line=107,col=33,[function_argument_linter] Arguments without defaults should come before arguments with defaults.

Check warning on line 107 in R/standardize.models.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/standardize.models.R,line=107,col=33,[function_argument_linter] Arguments without defaults should come before arguments with defaults.
...) {
m_info <- .get_model_info(x, ...)
data <- insight::get_data(x, source = "mf", verbose = FALSE)

Check warning on line 110 in R/standardize.models.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/standardize.models.R,line=110,col=3,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.

Check warning on line 110 in R/standardize.models.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/standardize.models.R,line=110,col=3,[object_overwrite_linter] 'data' is an exported object from package 'utils'. Avoid re-using such symbols.

if (isTRUE(attr(data, "is_subset"))) {
insight::format_error("Cannot standardize a model fit with a 'subset = '.")
Expand All @@ -120,7 +120,6 @@
}



## ---- Z the RESPONSE? ----
# 1. Some models have special responses that should not be standardized. This
# includes:
Expand Down Expand Up @@ -158,7 +157,6 @@
}



## ---- DO NOT Z: ----

# 1. WEIGHTS:
Expand Down Expand Up @@ -202,7 +200,6 @@
}



## ---- STANDARDIZE! ----

w <- insight::get_weights(x, remove_na = TRUE)
Expand Down Expand Up @@ -255,19 +252,13 @@
}





## ---- ADD BACK VARS THAT WHERE NOT Z ----
if (length(dont_standardize)) {
remaining_columns <- intersect(colnames(data), dont_standardize)
data_std <- cbind(data[, remaining_columns, drop = FALSE], data_std)
}





## ---- UPDATE MODEL WITH Z DATA ----
on.exit(.update_failed())

Expand Down Expand Up @@ -373,7 +364,7 @@


if (!is.null(covs)) {
covs <- mapply(.rescale_fixed_values, covs, names(covs),

Check warning on line 367 in R/standardize.models.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/standardize.models.R,line=367,col=13,[undesirable_function_linter] Avoid undesirable function "mapply".
SIMPLIFY = FALSE,
MoreArgs = list(
y_data = y_data, m_data = m_data,
Expand Down Expand Up @@ -447,9 +438,6 @@
# biglm doesn't regit the model to new data - it ADDs MORE data to the model.





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

# Find log-terms inside model formula, and return "clean" term names
Expand Down
1 change: 0 additions & 1 deletion R/text_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ text_paste <- function(text, text2 = NULL, sep = ", ", enclose = NULL, ...) {
}



#' @rdname text_format
#' @export
text_remove <- function(text, pattern = "", ...) {
Expand Down
1 change: 0 additions & 1 deletion R/to_numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ to_numeric.character <- function(x,
}



#' Convert to Numeric (if possible)
#'
#' Tries to convert vector to numeric if possible (if no warnings or errors).
Expand Down
2 changes: 0 additions & 2 deletions R/unstandardize.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ unstandardize.character <- function(x, ...) {
}



#' @export
unstandardize.grouped_df <- function(x,
center = NULL,
Expand Down Expand Up @@ -261,7 +260,6 @@ unstandardize.matrix <- function(x,
unstandardize.array <- unstandardize.matrix



# Datagrid ----------------------------------------------------------------

#' @export
Expand Down
2 changes: 0 additions & 2 deletions R/utils-cols.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ row_to_colnames <- function(x, row = 1, na_prefix = "x", verbose = TRUE) {
}




#' @rdname colnames
#' @export
colnames_to_row <- function(x, prefix = "x") {
Expand Down
1 change: 0 additions & 1 deletion R/utils-rows.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ column_as_rownames <- function(x, var = "rowname") {
}



#' @rdname rownames
#' @export
#' @examples
Expand Down
1 change: 0 additions & 1 deletion R/visualisation_recipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ print.visualisation_recipe <- function(x, ...) {
}



#' @export
plot.visualisation_recipe <- function(x, ...) {
insight::check_if_installed("see")
Expand Down
Loading
Loading