Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 25, 2023
1 parent 2c13c82 commit b5606c7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions R/plot.check_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ data_plot.check_outliers <- function(x, data = NULL, rescale_distance = TRUE, ..
row.names(data) <- data$Obs

# Extract distances
d <- data[grepl("Distance_", names(data))]
d <- data[grepl("Distance_", names(data), fixed = TRUE)]
if (rescale_distance) {
d <- datawizard::normalize(d, verbose = FALSE)
}
Expand All @@ -78,7 +78,7 @@ data_plot.check_outliers <- function(x, data = NULL, rescale_distance = TRUE, ..
)
d_long$Obs <- as.factor(d_long$id)
row.names(d_long) <- d_long$id <- NULL
d_long$Method <- gsub("Distance_", "", d_long$Method)
d_long$Method <- gsub("Distance_", "", d_long$Method, fixed = TRUE)
attr(d_long, "rescale_distance") <- isTRUE(rescale_distance)
d_long
}
Expand Down
2 changes: 1 addition & 1 deletion R/plot.check_outliers_new.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

min_cook_level <- min(cook.levels, na.rm = TRUE)
n_above <- sum(plot_data$Cooks_Distance >= min_cook_level, na.rm = TRUE)
label.n <- ifelse(n_above < 5, 5, n_above)
label.n <- pmax(n_above, 5)

p <- ggplot(plot_data, aes(x = .data$Hat, .data$Std_Residuals))

Expand Down
6 changes: 3 additions & 3 deletions R/plot.compare_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ plot.see_compare_parameters <- function(x,
#' @export
data_plot.see_compare_parameters <- function(x, ...) {
col_coefficient <- which(grepl("^(Coefficient|Log-Odds|Log-Mean|Odds Ratio|Risk Ratio|IRR)\\.", colnames(x)))
col_ci_low <- which(grepl("^CI_low\\.", colnames(x)))
col_ci_high <- which(grepl("^CI_high\\.", colnames(x)))
col_p <- which(grepl("^p\\.", colnames(x)))
col_ci_low <- which(startsWith(colnames(x), "CI_low."))
col_ci_high <- which(startsWith(colnames(x), "CI_high."))
col_p <- which(startsWith(colnames(x), "p."))

out1 <- .reshape_to_long(
x,
Expand Down
2 changes: 1 addition & 1 deletion R/plot.compare_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data_plot.compare_performance <- function(x, data = NULL, ...) {
}

# remove indices with missing value, comparison makes no sense here
x <- x[sapply(x, function(.x) !anyNA(.x))]
x <- x[vapply(x, function(.x) !anyNA(.x), logical(1))]

x <- .reshape_to_long(x, names_to = "name", columns = 2:ncol(x))
x$name <- factor(x$name, levels = unique(x$name))
Expand Down
8 changes: 4 additions & 4 deletions R/plot.effectsize_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ plot.see_effectsize_table <- function(x, ...) {
x$Parameter <- factor(x$Parameter, levels = rev(unique(x$Parameter)))

es_name <- colnames(x)[effectsize::is_effectsize_name(colnames(x))]
es_lab <- gsub("_", " ", es_name)
es_lab <- gsub("partial", "(partial)", es_lab)
es_lab <- gsub("_", " ", es_name, fixed = TRUE)
es_lab <- gsub("partial", "(partial)", es_lab, fixed = TRUE)

x$.es <- x[, es_name]

Expand Down Expand Up @@ -67,8 +67,8 @@ plot.see_equivalence_test_effectsize <- function(x, ...) {
}

es_name <- colnames(x)[effectsize::is_effectsize_name(colnames(x))]
es_lab <- gsub("_", " ", es_name)
es_lab <- gsub("partial", "(partial)", es_lab)
es_lab <- gsub("_", " ", es_name, fixed = TRUE)
es_lab <- gsub("partial", "(partial)", es_lab, fixed = TRUE)

x$.es <- x[, es_name]

Expand Down
2 changes: 1 addition & 1 deletion R/plot.hdi.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ data_plot.bayestestR_eti <- data_plot.hdi

out$HDI_low <- sapply(out$x, .classify_hdi, hdi$CI_low, c(100, 100 * hdi$CI))
out$HDI_high <- sapply(out$x, .classify_hdi, rev(hdi$CI_high), c(rev(100 * hdi$CI), 100))
out$fill <- as.factor(ifelse(out$HDI_low > out$HDI_high, out$HDI_low, out$HDI_high))
out$fill <- as.factor(pmax(out$HDI_low, out$HDI_high))
out$height <- out$y
out$y <- name

Expand Down

0 comments on commit b5606c7

Please sign in to comment.