From 8563d1508163e85ae0a892b280bbad5be1562dc9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2023 13:20:34 +0200 Subject: [PATCH 1/5] fix examples --- R/data_plot.R | 2 +- man/data_plot.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/data_plot.R b/R/data_plot.R index 9afa86843..a369d7b3d 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -67,7 +67,7 @@ #' x <- hdi(model) #' plot(x) + theme_modern() #' -#' data <- rnorm(1000, 1) +#' data <<- rnorm(1000, 1) #' x <- p_direction(data) #' plot(x) #' diff --git a/man/data_plot.Rd b/man/data_plot.Rd index 4daef23d7..136ac4499 100644 --- a/man/data_plot.Rd +++ b/man/data_plot.Rd @@ -81,7 +81,7 @@ plot(x) x <- hdi(model) plot(x) + theme_modern() -data <- rnorm(1000, 1) +data <<- rnorm(1000, 1) x <- p_direction(data) plot(x) From a23ac8180e20ff880b685e8a2fe3116968f88e05 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2023 13:21:35 +0200 Subject: [PATCH 2/5] fix vignette --- vignettes/bayestestR.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/bayestestR.Rmd b/vignettes/bayestestR.Rmd index 9d71a0b88..12bf22c15 100644 --- a/vignettes/bayestestR.Rmd +++ b/vignettes/bayestestR.Rmd @@ -66,10 +66,10 @@ theme_set(theme_modern()) ```{r} set.seed(123) # model with fixed effects only -model <- rstanarm::stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0) +model <<- rstanarm::stan_glm(Sepal.Length ~ Petal.Width * Species, data = iris, refresh = 0) # model with fixed and random effects as well as zero-inflation component -model2 <- insight::download_model("brms_zi_3") +model2 <<- insight::download_model("brms_zi_3") ``` ## Density Estimation From ab8076b9e4d89352dc76db68680c3b29545338d6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2023 13:44:54 +0200 Subject: [PATCH 3/5] verbose = FALSE --- vignettes/bayestestR.Rmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vignettes/bayestestR.Rmd b/vignettes/bayestestR.Rmd index 12bf22c15..57cf7b851 100644 --- a/vignettes/bayestestR.Rmd +++ b/vignettes/bayestestR.Rmd @@ -335,7 +335,13 @@ plot(result) + ``` ```{r fig.width=11, fig.height=9} -result <- equivalence_test(model2, ci = c(0.89, 0.95), effects = "all", component = "all") +result <- equivalence_test( + model2, + ci = c(0.89, 0.95), + effects = "all", + component = "all", + verbose = FALSE +) result From 48c7d9e2edc4fa166d8e9c08740ede11b7f51fe7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 7 Oct 2023 13:45:35 +0200 Subject: [PATCH 4/5] remove annoying example --- R/data_plot.R | 4 ---- man/data_plot.Rd | 4 ---- 2 files changed, 8 deletions(-) diff --git a/R/data_plot.R b/R/data_plot.R index a369d7b3d..3b916383f 100644 --- a/R/data_plot.R +++ b/R/data_plot.R @@ -67,10 +67,6 @@ #' x <- hdi(model) #' plot(x) + theme_modern() #' -#' data <<- rnorm(1000, 1) -#' x <- p_direction(data) -#' plot(x) -#' #' x <- p_direction(model, verbose = FALSE) #' plot(x) #' diff --git a/man/data_plot.Rd b/man/data_plot.Rd index 136ac4499..af31261df 100644 --- a/man/data_plot.Rd +++ b/man/data_plot.Rd @@ -81,10 +81,6 @@ plot(x) x <- hdi(model) plot(x) + theme_modern() -data <<- rnorm(1000, 1) -x <- p_direction(data) -plot(x) - x <- p_direction(model, verbose = FALSE) plot(x) From 9d8c7768a61a8b49f47887ec4536326a05e22029 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 7 Oct 2023 19:58:18 +0200 Subject: [PATCH 5/5] lints --- R/plot.check_outliers.R | 14 +++++++------- R/plot.check_outliers_new.R | 2 +- R/plot.compare_performance.R | 8 ++++---- R/plot.describe_distribution.R | 2 +- R/plot.estimate_contrasts.R | 12 ++++++------ R/plot.estimate_density.R | 10 +++++----- R/plot.hdi.R | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/R/plot.check_outliers.R b/R/plot.check_outliers.R index 4cf04f5c8..eae2b173f 100644 --- a/R/plot.check_outliers.R +++ b/R/plot.check_outliers.R @@ -97,13 +97,13 @@ data_plot.check_outliers <- function(x, data = NULL, rescale_distance = TRUE, .. d$Id[d$Outliers == "0"] <- NA method <- switch(attr(x, "method", exact = TRUE), - "cook" = "Cook's Distance", - "pareto" = "Pareto", - "mahalanobis" = "Mahalanobis Distance", - "ics" = "Invariant Coordinate Selection", - "mcd" = "Minimum Covariance Determinant", - "optics" = "OPTICS", - "iforest" = "Isolation Forest", + cook = "Cook's Distance", + pareto = "Pareto", + mahalanobis = "Mahalanobis Distance", + ics = "Invariant Coordinate Selection", + mcd = "Minimum Covariance Determinant", + optics = "OPTICS", + iforest = "Isolation Forest", "Cook's Distance" ) diff --git a/R/plot.check_outliers_new.R b/R/plot.check_outliers_new.R index b8d895dd0..9ade11d2e 100644 --- a/R/plot.check_outliers_new.R +++ b/R/plot.check_outliers_new.R @@ -44,7 +44,7 @@ se = FALSE, color = colors[1] ) + - scale_colour_manual(values = c("OK" = colors[2], "Influential" = colors[3])) + + scale_colour_manual(values = c(OK = colors[2], Influential = colors[3])) + (if (isTRUE(show_labels)) { if (requireNamespace("ggrepel", quietly = TRUE)) { ggrepel::geom_text_repel( diff --git a/R/plot.compare_performance.R b/R/plot.compare_performance.R index 3db5c7871..c61c42fce 100644 --- a/R/plot.compare_performance.R +++ b/R/plot.compare_performance.R @@ -40,10 +40,10 @@ data_plot.compare_performance <- function(x, data = NULL, ...) { dataplot$values[dataplot$values > 1] <- 1 attr(dataplot, "info") <- list( - "xlab" = "", - "ylab" = "", - "title" = "Comparison of Model Indices", - "legend_color" = "Models" + xlab = "", + ylab = "", + title = "Comparison of Model Indices", + legend_color = "Models" ) class(dataplot) <- c("data_plot", "see_compare_performance", "data.frame") diff --git a/R/plot.describe_distribution.R b/R/plot.describe_distribution.R index 4f3012b72..653c594a0 100644 --- a/R/plot.describe_distribution.R +++ b/R/plot.describe_distribution.R @@ -199,7 +199,7 @@ plot.see_parameters_distribution <- function(x, } names(highlight_color) <- highlight - highlight_color <- c(highlight_color, "no_highlight" = "grey70") + highlight_color <- c(highlight_color, no_highlight = "grey70") p <- p + scale_fill_manual(values = highlight_color) + diff --git a/R/plot.estimate_contrasts.R b/R/plot.estimate_contrasts.R index d2f329b89..2dbfbbfeb 100644 --- a/R/plot.estimate_contrasts.R +++ b/R/plot.estimate_contrasts.R @@ -16,9 +16,9 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { dataplot <- .data_contrasts_and_means(x, means, x_name = x_name, y_name = y_name) attr(dataplot, "info") <- list( - "xlab" = x_name, - "ylab" = y_name, - "title" = paste0("Estimated ", y_name, "s and Contrasts") + xlab = x_name, + ylab = y_name, + title = paste0("Estimated ", y_name, "s and Contrasts") ) class(dataplot) <- c("data_plot", "see_estimate_contrasts", class(dataplot)) @@ -45,9 +45,9 @@ data_plot.estimate_contrasts <- function(x, data = NULL, ...) { polygons <- merge(polygons, data_means[c("Level2", "Mean2")], by = "Level2") polygons <- rbind( - cbind(polygons, data.frame("x" = polygons$Level1, "y" = polygons$Mean1)), - cbind(polygons, data.frame("x" = polygons$Level2, "y" = polygons$Mean1 - polygons$CI_low)), - cbind(polygons, data.frame("x" = polygons$Level2, "y" = polygons$Mean1 - polygons$CI_high)) + cbind(polygons, data.frame(x = polygons$Level1, y = polygons$Mean1)), + cbind(polygons, data.frame(x = polygons$Level2, y = polygons$Mean1 - polygons$CI_low)), + cbind(polygons, data.frame(x = polygons$Level2, y = polygons$Mean1 - polygons$CI_high)) ) list( diff --git a/R/plot.estimate_density.R b/R/plot.estimate_density.R index f472bcad7..ad431a8c6 100644 --- a/R/plot.estimate_density.R +++ b/R/plot.estimate_density.R @@ -51,11 +51,11 @@ data_plot.estimate_density <- function(x, attr(dataplot, "summary") <- summary attr(dataplot, "info") <- list( - "xlab" = "Values", - "ylab" = "Density", - "legend_fill" = "Parameter", - "legend_color" = "Parameter", - "title" = "Estimated Density Function" + xlab = "Values", + ylab = "Density", + legend_fill = "Parameter", + legend_color = "Parameter", + title = "Estimated Density Function" ) class(dataplot) <- c("data_plot", "see_estimate_density", class(dataplot)) diff --git a/R/plot.hdi.R b/R/plot.hdi.R index bab66afe9..03b33e79c 100644 --- a/R/plot.hdi.R +++ b/R/plot.hdi.R @@ -121,10 +121,10 @@ data_plot.bayestestR_eti <- data_plot.hdi dataplot <- .fix_facet_names(dataplot) attr(dataplot, "info") <- list( - "xlab" = "Possible parameter values", - "ylab" = ylab, - "legend_fill" = legend_title, - "title" = plot_title + xlab = "Possible parameter values", + ylab = ylab, + legend_fill = legend_title, + title = plot_title ) class(dataplot) <- c("data_plot", "see_hdi", class(dataplot))