From d68982d6b9bc383aefbcf29ebbabecc33c06833f Mon Sep 17 00:00:00 2001 From: bgreenwell Date: Fri, 18 Aug 2023 15:28:12 -0400 Subject: [PATCH] tweak tests and fix some old URLs --- NAMESPACE | 1 + R/vip.R | 5 +++++ man/vip.Rd | 10 ++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index a20feeea..1165d98c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -58,3 +58,4 @@ export(vip) importFrom(foreach,"%do%") importFrom(foreach,"%dopar%") importFrom(foreach,foreach) +importFrom(stats,reorder) diff --git a/R/vip.R b/R/vip.R index be30c274..493da39b 100644 --- a/R/vip.R +++ b/R/vip.R @@ -1,3 +1,6 @@ +Variable <- NULL +Importance <- NULL + #' Variable importance plots #' #' Plot variable importance scores for the predictors in a model. @@ -51,6 +54,8 @@ #' #' @param ... Additional optional arguments to be passed on to [vi][vip::vi]. #' +#' @importFrom stats reorder +#' #' @rdname vip #' #' @export diff --git a/man/vip.Rd b/man/vip.Rd index 55c98f00..b3d95839 100644 --- a/man/vip.Rd +++ b/man/vip.Rd @@ -58,8 +58,9 @@ only for the permutation-based importance method with \code{nsim > 1} and \code{keep = TRUE}; see \link[=vi_permute]{vi_permute} for details. }} -\item{mapping}{Set of aesthetic mappings created by \link[ggplot2:aes]{aes} -or \link[ggplot2:aes_]{aes_}. See example usage below.} +\item{mapping}{Set of aesthetic mappings created by +\link[ggplot2:aes]{aes}-related functions and/or tidy eval helpers. See example +usage below.} \item{aesthetics}{List specifying additional arguments passed on to \link[ggplot2:layer]{layer}. These are often aesthetics, used to set an aesthetic @@ -107,9 +108,10 @@ vip(vis, geom = "point", horiz = FALSE) vip(vis, geom = "point", horiz = FALSE, aesthetics = list(size = 3)) # Plot unaggregated permutation scores (boxplot colored by feature) -library(ggplot2) # for `aes_string()` function +library(ggplot2) # for `aes()`-related functions and tidy eval helpers vip(vis, geom = "boxplot", all_permutations = TRUE, jitter = TRUE, - mapping = aes_string(fill = "Variable"), + #mapping = aes_string(fill = "Variable"), # for ggplot2 (< 3.0.0) + mapping = aes(fill = .data[["Variable"]]), # for ggplot2 (>= 3.0.0) aesthetics = list(color = "grey35", size = 0.8)) #