diff --git a/R/plot.hdi.R b/R/plot.hdi.R index dae9b18b7..490289b24 100644 --- a/R/plot.hdi.R +++ b/R/plot.hdi.R @@ -108,7 +108,7 @@ data_plot.bayestestR_eti <- data_plot.hdi groups <- unique(dataplot$y) if (!show_intercept) { dataplot <- .remove_intercept(dataplot, column = "y", show_intercept) - groups <- unique(setdiff(groups, .intercepts())) + groups <- unique(setdiff(groups, .intercept_names)) } if (length(groups) == 1) { diff --git a/R/plot.p_direction.R b/R/plot.p_direction.R index d8e5d9d88..112c7b19b 100644 --- a/R/plot.p_direction.R +++ b/R/plot.p_direction.R @@ -95,7 +95,7 @@ data_plot.p_direction <- function(x, data = NULL, show_intercept = FALSE, ...) { groups <- unique(dataplot$y) if (!show_intercept) { dataplot <- .remove_intercept(dataplot, column = "y", show_intercept) - groups <- unique(setdiff(groups, .intercepts())) + groups <- unique(setdiff(groups, .intercept_names)) } if (length(groups) == 1) { diff --git a/R/plot.p_significance.R b/R/plot.p_significance.R index d47a8423a..216f617f8 100644 --- a/R/plot.p_significance.R +++ b/R/plot.p_significance.R @@ -103,7 +103,7 @@ data_plot.p_significance <- function(x, groups <- unique(dataplot$y) if (!show_intercept) { dataplot <- .remove_intercept(dataplot, column = "y", show_intercept) - groups <- unique(setdiff(groups, .intercepts())) + groups <- unique(setdiff(groups, .intercept_names)) } if (length(groups) == 1) { diff --git a/R/plot.rope.R b/R/plot.rope.R index 9ed3d46a4..dd7b71493 100644 --- a/R/plot.rope.R +++ b/R/plot.rope.R @@ -42,7 +42,7 @@ data_plot.rope <- function(x, data = NULL, show_intercept = FALSE, ...) { groups <- unique(dataplot$y) if (!show_intercept) { dataplot <- .remove_intercept(dataplot, column = "y", show_intercept = show_intercept) - groups <- unique(setdiff(groups, .intercepts())) + groups <- unique(setdiff(groups, .intercept_names)) } if (length(groups) == 1) { diff --git a/R/utils.R b/R/utils.R index 9a3e312b3..2b0360238 100644 --- a/R/utils.R +++ b/R/utils.R @@ -113,7 +113,7 @@ -.intercepts <- function() { +.intercept_names <- c( "(intercept)_zi", "intercept (zero-inflated)", @@ -123,12 +123,11 @@ "b_intercept", "b_zi_intercept" ) -} .is_intercept <- function(x) { x <- tolower(x) - x %in% .intercepts() | grepl("intercept", x) + x %in% .intercept_names | grepl("(?i)intercept[^a-zA-Z]", x) } .remove_intercept <- function(x, column = "Parameter", show_intercept = FALSE) {