Skip to content

Commit

Permalink
Stricter regex and change .intercepts() to a vector
Browse files Browse the repository at this point in the history
  • Loading branch information
bwiernik committed Jul 15, 2023
1 parent 3c7ad13 commit 1577e05
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/plot.hdi.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion R/plot.p_direction.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion R/plot.p_significance.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion R/plot.rope.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@



.intercepts <- function() {
.intercept_names <-
c(
"(intercept)_zi",
"intercept (zero-inflated)",
Expand All @@ -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) {
Expand Down

0 comments on commit 1577e05

Please sign in to comment.