首页 > 解决方案 > 在给出一个带有串扰和情节组合的代码块之后。我无法正确导出任何 html 输出

问题描述

我必须在 Rmarkdown 文档的一侧制作一个带有下拉过滤器菜单的条形图。但是问题是,当我将它添加为“r 块”时,我无法将其导出为静态 html 格式。

问题是在我的工作中使用 R shiny 是一种可行的方法。所以这是我到目前为止的代码:

library(crosstalk)
library(ggplot2)
library(plotly)

iris_data <-
SharedData$new(iris, key = ~Species, group = "Select Specie")
bscols(
    filter_select("species", "Species", iris_data, ~Species, multiple = FALSE)
  ,

plot_ly(iris_data, x = ~Sepal.Length, y = ~Petal.Length, type = 'bar', name = ~Species, color= ~Species, text = ~ Sepal.Width) %>% layout(iris_data, barmode = 'stack'))

另一方面,当我将文档编织成 html 时,预览仅显示顶部标题部分,然后冻结,当我尝试使用 Firefox 打开它时,html 文件崩溃。感谢您的任何建议!

标签: rr-markdownplotly

解决方案


推荐阅读