diff --git a/DESCRIPTION b/DESCRIPTION index a42e5b15..b5721146 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: sjPlot Type: Package Encoding: UTF-8 Title: Data Visualization for Statistics in Social Science -Version: 2.8.16.2 +Version: 2.8.16.3 Authors@R: c( person("Daniel", "Lüdecke", email = "d.luedecke@uke.de", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-8895-3206")), person("Alexander", "Bartel", role = "ctb", comment = c(ORCID = "0000-0002-1280-6138")), @@ -71,5 +71,6 @@ Suggests: testthat URL: https://strengejacke.github.io/sjPlot/ BugReports: https://github.com/strengejacke/sjPlot/issues -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 VignetteBuilder: knitr +Remotes: strengejacke/ggeffects diff --git a/R/plot_grid.R b/R/plot_grid.R index d2c8cec1..16788555 100644 --- a/R/plot_grid.R +++ b/R/plot_grid.R @@ -31,13 +31,13 @@ #' #' # plot marginal effects for each predictor, each as single plot #' p1 <- ggpredict(fit, "c12hour") %>% -#' plot(show.y.title = FALSE, show.title = FALSE) +#' plot(show_y_title = FALSE, show_title = FALSE) #' p2 <- ggpredict(fit, "e17age") %>% -#' plot(show.y.title = FALSE, show.title = FALSE) +#' plot(show_y_title = FALSE, show_title = FALSE) #' p3 <- ggpredict(fit, "e42dep") %>% -#' plot(show.y.title = FALSE, show.title = FALSE) +#' plot(show_y_title = FALSE, show_title = FALSE) #' p4 <- ggpredict(fit, "neg_c_7") %>% -#' plot(show.y.title = FALSE, show.title = FALSE) +#' plot(show_y_title = FALSE, show_title = FALSE) #' #' # plot grid #' plot_grid(list(p1, p2, p3, p4)) diff --git a/R/plot_type_eff.R b/R/plot_type_eff.R index cf48e741..d9898e06 100644 --- a/R/plot_type_eff.R +++ b/R/plot_type_eff.R @@ -20,6 +20,12 @@ plot_type_eff <- function(type, if (missing(facets) || is.null(facets)) facets <- FALSE + pred.type <- switch(pred.type, + fe = "fixed", + re = "random", + pred.type + ) + if (type == "pred") { dat <- ggeffects::ggpredict( model = model, diff --git a/R/plot_type_int.R b/R/plot_type_int.R index 0cae37f1..33b0fbd3 100644 --- a/R/plot_type_int.R +++ b/R/plot_type_int.R @@ -98,6 +98,11 @@ plot_type_int <- function(model, # compute marginal effects for interaction terms + pred.type <- switch(pred.type, + fe = "fixed", + re = "random", + pred.type + ) dat <- ggeffects::ggpredict( model = model, diff --git a/man/plot_grid.Rd b/man/plot_grid.Rd index 9a7e36bd..0181212f 100644 --- a/man/plot_grid.Rd +++ b/man/plot_grid.Rd @@ -42,13 +42,13 @@ if (require("dplyr") && require("gridExtra")) { # plot marginal effects for each predictor, each as single plot p1 <- ggpredict(fit, "c12hour") \%>\% - plot(show.y.title = FALSE, show.title = FALSE) + plot(show_y_title = FALSE, show_title = FALSE) p2 <- ggpredict(fit, "e17age") \%>\% - plot(show.y.title = FALSE, show.title = FALSE) + plot(show_y_title = FALSE, show_title = FALSE) p3 <- ggpredict(fit, "e42dep") \%>\% - plot(show.y.title = FALSE, show.title = FALSE) + plot(show_y_title = FALSE, show_title = FALSE) p4 <- ggpredict(fit, "neg_c_7") \%>\% - plot(show.y.title = FALSE, show.title = FALSE) + plot(show_y_title = FALSE, show_title = FALSE) # plot grid plot_grid(list(p1, p2, p3, p4))