From ba6d3c5b2a26f8ccea6cda06063244b18b02c21e Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Wed, 17 Apr 2019 19:07:59 -0400 Subject: [PATCH 1/2] :sparkles: add support for plotly pkg 'subplots' --- R/utils.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index dec7b2ee..2ec9b760 100644 --- a/R/utils.R +++ b/R/utils.R @@ -577,8 +577,9 @@ get_asset_url <- function(asset_path, prefix = "/") { encode_plotly <- function(layout_objs) { if (is.list(layout_objs)) { - if ("x" %in% names(layout_objs) && - "visdat" %in% names(layout_objs$x)) { + if ("plotly" %in% class(layout_objs) && + "x" %in% names(layout_objs) && + any(names(layout_objs$x) == c("visdat", "data"))) { # check to determine whether the current element is an # object output from the plot_ly or ggplotly function; # if it is, we can safely assume that it contains no From 5264c7ca3d52fd8ef5cc5ef28d5ac18f5fbf705a Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Wed, 17 Apr 2019 19:21:51 -0400 Subject: [PATCH 2/2] :bug: fix to remove warning --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 2ec9b760..94820d6d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -579,7 +579,7 @@ encode_plotly <- function(layout_objs) { if (is.list(layout_objs)) { if ("plotly" %in% class(layout_objs) && "x" %in% names(layout_objs) && - any(names(layout_objs$x) == c("visdat", "data"))) { + any(c("visdat", "data") %in% names(layout_objs$x))) { # check to determine whether the current element is an # object output from the plot_ly or ggplotly function; # if it is, we can safely assume that it contains no