From 4d957abedfd4ff9202d34703ca857b06891519ae Mon Sep 17 00:00:00 2001 From: bersbersbers <12128514+bersbersbers@users.noreply.github.com> Date: Wed, 13 Oct 2021 23:39:45 +0200 Subject: [PATCH 1/3] Fix "partial argument match" warnings (#1977) --- R/ggplotly.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/ggplotly.R b/R/ggplotly.R index 6db8b6547b..c9ccda8bc7 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -182,7 +182,7 @@ gg2list <- function(p, width = NULL, height = NULL, } else if (capabilities("jpeg")) { grDevices::jpeg } else if (system.file(package = "Cairo") != "") { - Cairo::Cairo + function(filename, ...) Cairo::Cairo(file = filename, ...) } else { stop( "No Cairo or bitmap device is available. Such a graphics device is required to convert sizes correctly in ggplotly().\n\n", @@ -198,7 +198,7 @@ gg2list <- function(p, width = NULL, height = NULL, height <- height %||% default(grDevices::dev.size("px")[2]) } # open the device and make sure it closes on exit - dev_fun(file = tempfile(), width = width %||% 640, height = height %||% 480) + dev_fun(filename = tempfile(), width = width %||% 640, height = height %||% 480) on.exit(grDevices::dev.off(), add = TRUE) # check the value of dynamicTicks From 4f66dc3f51f434157a3f788a55ea733637f941a0 Mon Sep 17 00:00:00 2001 From: bersbersbers <12128514+bersbersbers@users.noreply.github.com> Date: Wed, 13 Oct 2021 23:41:44 +0200 Subject: [PATCH 2/3] No partial-argument-match warning in ggplotly --- tests/testthat/test-ggplot-warnings.R | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/testthat/test-ggplot-warnings.R diff --git a/tests/testthat/test-ggplot-warnings.R b/tests/testthat/test-ggplot-warnings.R new file mode 100644 index 0000000000..f72dfcee22 --- /dev/null +++ b/tests/testthat/test-ggplot-warnings.R @@ -0,0 +1,7 @@ + + +test_that("ggplotly does not issue partial-argument-match warning", { + p <- ggplot(data.frame()) + rlang::scoped_options(warnPartialMatchArgs = TRUE) + expect_warning(ggplotly(p), regexp = NA) +}) From dfdb6ff4aedc363e14d109b5fe6c769171e65d52 Mon Sep 17 00:00:00 2001 From: bersbersbers <12128514+bersbersbers@users.noreply.github.com> Date: Fri, 15 Oct 2021 09:13:02 +0200 Subject: [PATCH 3/3] Update NEWS.md --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index a71da718f9..56775ea13a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # 4.10.0.9000 +## Improvements + +* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, @bersbersbers) # 4.10.0