Skip to content

Commit

Permalink
Release 0.11.0 (#510)
Browse files Browse the repository at this point in the history
* Release 0.11.0

* lintr

* remove Remotes field

* lintr [skip_ci]

---------

Co-authored-by: Daniel <[email protected]>
  • Loading branch information
etiennebacher and strengejacke authored Jun 5, 2024
1 parent 61f84c2 commit 62c089a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
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 @@ -20,16 +20,16 @@ format.parameters_distribution <- function(x, digits = 2, format = NULL, ci_widt
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

0 comments on commit 62c089a

Please sign in to comment.