From 13ff581403280f8fb24f38e80a0628968a62392c Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 15 May 2019 11:48:45 -0300 Subject: [PATCH] Dynamically assign pathGrob in .onLoad() to prevent packages that subclass GeomPolygon from throwing an install warning. Fixes #3312. --- R/zzz.r | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/R/zzz.r b/R/zzz.r index 3e5843be7b..0bca0d6136 100644 --- a/R/zzz.r +++ b/R/zzz.r @@ -16,9 +16,21 @@ }) } +# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon +# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ': +# unused argument (pathId = munched$group)` despite the fact that this is correct +# usage +pathGrob <- NULL + .onLoad <- function(...) { backport_unit_methods() + if (getRversion() < as.numeric_version("3.6")) { + pathGrob <<- function(..., pathId.lengths) { + grid::pathGrob(...) + } + } + .zeroGrob <<- grob(cl = "zeroGrob", name = "NULL") ggplot_global$theme_current <- theme_gray()