Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 5, 2024
1 parent d3c30c9 commit 16b3e03
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/plot.p_significance.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data_plot.p_significance <- function(x,
data <- data[, x$Parameter, drop = FALSE]
dataplot <- data.frame()
for (i in names(data)) {
if (is.null(params)) {
if (is.null(params) || !all(c("Effects", "Component") %in% colnames(params))) {
dataplot <- rbind(
dataplot,
.compute_densities_ps(data[[i]], name = i, threshold = attr(x, "threshold"))
Expand Down Expand Up @@ -160,7 +160,7 @@ data_plot.p_significance <- function(x,

# normalize
range_diff <- diff(range(out$height, na.rm = TRUE), na.rm = TRUE)
out$height <- as.vector(out$height - min(out$height, na.rm = TRUE) / range_diff)
out$height <- as.vector((out$height - min(out$height, na.rm = TRUE)) / range_diff)
out
}

Expand Down
4 changes: 3 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@

# clean parameters names
params <- gsub("(b_|bs_|bsp_|bcs_)(.*)", "\\2", params, perl = TRUE)
params <- gsub("^zi_(.*)", "\\1 (Zero-Inflated)", params, perl = TRUE)
params <- gsub("^cond_(.*)", "\\1 (Conditional)", params, perl = TRUE)
params <- gsub("(.*)_cond$", "\\1 (Conditional)", params, perl = TRUE)
params <- gsub("^zi_(.*)", "\\1 (Zero-Inflated)", params, perl = TRUE)
params <- gsub("(.*)_zi$", "\\1 (Zero-Inflated)", params, perl = TRUE)
params <- gsub("(.*)_disp$", "\\1 (Dispersion)", params, perl = TRUE)
# clean random effect parameters names
Expand Down
Loading

0 comments on commit 16b3e03

Please sign in to comment.