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

Release 0.11.0 #510

Merged
merged 5 commits into from
Jun 5, 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
4 changes: 1 addition & 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.10.0.6
Version: 0.11.0
Authors@R: c(
person("Indrajeet", "Patil", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0003-1995-6531", Twitter = "@patilindrajeets")),
Expand Down Expand Up @@ -68,8 +68,6 @@ Suggests:
tibble,
tidyr,
withr
Remotes:
easystats/modelbased, easystats/insight
VignetteBuilder:
knitr
Encoding: UTF-8
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# datawizard 0.10.1
# datawizard 0.11.0

BREAKING CHANGES

Expand Down
12 changes: 6 additions & 6 deletions R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
}

if (all(c("CI_low", "CI_high") %in% names(x))) {
x$CI_low <- insight::format_ci(x$CI_low, x$CI_high, ci = NULL, digits = digits, width = ci_width, brackets = ci_brackets)

Check warning on line 18 in R/format.R

View workflow job for this annotation

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

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

Check warning on line 18 in R/format.R

View workflow job for this annotation

GitHub Actions / lint / lint

file=R/format.R,line=18,col=121,[line_length_linter] Lines should not be more than 120 characters. This line is 125 characters.
x$CI_high <- NULL
ci_lvl <- attributes(x)$ci
centrality_ci <- attributes(x)$first_centrality

if (!is.null(centrality_ci)) {
ci_suffix <- paste0(" (", centrality_ci, ")")
} else {
if (is.null(centrality_ci)) {
ci_suffix <- ""
} else {
ci_suffix <- paste0(" (", centrality_ci, ")")
}

if (!is.null(ci_lvl)) {
colnames(x)[which(colnames(x) == "CI_low")] <- sprintf("%i%% CI%s", round(100 * ci_lvl), ci_suffix)
} else {
if (is.null(ci_lvl)) {
colnames(x)[which(colnames(x) == "CI_low")] <- sprintf("CI%s", ci_suffix)
} else {
colnames(x)[which(colnames(x) == "CI_low")] <- sprintf("%i%% CI%s", round(100 * ci_lvl), ci_suffix)
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/remove_empty.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ empty_rows <- function(x) {
if ((!is.matrix(x) && !is.data.frame(x)) || nrow(x) < 2) {
vector("numeric")
} else {
which(rowSums((is.na(x) | x == "")) == ncol(x))
which(rowSums((is.na(x) | x == "")) == ncol(x)) # nolint
}
}

Expand Down
14 changes: 7 additions & 7 deletions R/reshape_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ reshape_ci <- function(x, ci_type = "CI") {

# Reshape
if (length(unique(x$CI)) > 1) {
if (!"Parameter" %in% names(x)) {
if ("Parameter" %in% names(x)) {
remove_parameter <- FALSE
} else {
x$Parameter <- NA
remove_parameter <- TRUE
} else {
remove_parameter <- FALSE
}

x <- stats::reshape(
Expand All @@ -70,17 +70,17 @@ reshape_ci <- function(x, ci_type = "CI") {

# Wide to long --------------
} else {
if (!"Parameter" %in% names(x)) {
if ("Parameter" %in% names(x)) {
remove_parameter <- FALSE
} else {
x$Parameter <- seq_len(nrow(x))
remove_parameter <- TRUE
} else {
remove_parameter <- FALSE
}

lows <- grepl(paste0(ci_low, "_*"), names(x))
highs <- grepl(paste0(ci_high, "_*"), names(x))
ci <- as.numeric(gsub(paste0(ci_low, "_"), "", names(x)[lows]))
if (paste0(ci, collapse = "-") != paste0(gsub(paste0(ci_high, "_"), "", names(x)[highs]), collapse = "-")) {
if (paste(ci, collapse = "-") != paste(gsub(paste0(ci_high, "_"), "", names(x)[highs]), collapse = "-")) {
insight::format_error("Something went wrong in the CIs reshaping.")
return(x)
}
Expand Down
Loading