无法在FlexDashboard中渲染HTML文档

发布于 2025-02-06 18:00:27 字数 1986 浏览 1 评论 0原文

我正在尝试使用Shiny在FlexDashbaord中渲染HTML文档。我正在使用一些代码从用户给出的输入中产生HTML文件。

这里

---
title: "Report"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    theme: 
      version: 3
      bootswatch: yeti
runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(highcharter)
library(gt)
library(htmltools)
library(viridis)
library(dplyr)
library(ggplot2)
library(shiny)


Column {.sidebar}
-----------------------------------------------------------------------

```{r echo=FALSE}

    selectInput("select_year", 
            label = "Year", 
            choices = c("2012", "2013", "2014")) 
    hr()
    
    selectInput("select_code", 
            label = "Course", 
            choices = c("i12", "i13", "i14"))
    
    hr()
    
    
    selectInput("select_title", 
            label = "Select a Discussion", 
            choices = c("Discussion on..", 
                        "Twitter trolls…", 
                        "NBA…"))
    
    hr()
    
    
    actionButton("update", "List Discussions", 
                 icon("refresh"),
                 class = "btn btn-primary")
    
Row
----------------------------------------------------------

reactive({
  htmltools::includeHTML(
  input$update,
  map1 %>%
    filter(Year == isolate(input$select_year)) %>% 
    filter(course_code == isolate(input$select_code)) %>% 
    filter(Title == isolate(input$select_title)) %>% 
    filter(text %in% sample(unique(text))) %>%
    dplyr::mutate(review = get_sentences(comments)) %$%
    sentiment_by(review, text) %>%
    highlight("highlights.html")
)
})```

数据 将其渲染在仪表板

如何访问从代码生成的此HTML文件以在我的FlexDashboard上显示?

I am trying to render an HTML document inside Flexdashbaord using shiny. I am using some code to produce an HTML file from the inputs processed given by the user.

Data: here

Below is the code:

---
title: "Report"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    theme: 
      version: 3
      bootswatch: yeti
runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(highcharter)
library(gt)
library(htmltools)
library(viridis)
library(dplyr)
library(ggplot2)
library(shiny)


Column {.sidebar}
-----------------------------------------------------------------------

```{r echo=FALSE}

    selectInput("select_year", 
            label = "Year", 
            choices = c("2012", "2013", "2014")) 
    hr()
    
    selectInput("select_code", 
            label = "Course", 
            choices = c("i12", "i13", "i14"))
    
    hr()
    
    
    selectInput("select_title", 
            label = "Select a Discussion", 
            choices = c("Discussion on..", 
                        "Twitter trolls…", 
                        "NBA…"))
    
    hr()
    
    
    actionButton("update", "List Discussions", 
                 icon("refresh"),
                 class = "btn btn-primary")
    
Row
----------------------------------------------------------

reactive({
  htmltools::includeHTML(
  input$update,
  map1 %>%
    filter(Year == isolate(input$select_year)) %>% 
    filter(course_code == isolate(input$select_code)) %>% 
    filter(Title == isolate(input$select_title)) %>% 
    filter(text %in% sample(unique(text))) %>%
    dplyr::mutate(review = get_sentences(comments)) %$%
    sentiment_by(review, text) %>%
    highlight("highlights.html")
)
})```

I cannot find a way to render it inside the dashboard

enter image description here

How can I access this HTML file generated from the code to display on my flexdashboard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不及他 2025-02-13 18:00:27

InclubelHTML函数的路径为参数。您必须首先渲染HTML,然后调用它。 BU如果使用“运行时:闪亮”,则无法使用生成的HTML。

The includeHTML function has path as parameter. You have to render first the html and then call it. Bu If you use "runtime: shiny" you can't use the generated html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文