r - 尝试将 selectInput() 添加到 flexdashboard 时 Pandoc 文档转换失败

标签 r shiny flexdashboard

我尝试向我的 Flexdashboard 添加一个简单的 selectInput() 但我得到:

File shared/selectize/css/selectize.bootstrap3.css not found in resource path
Error: pandoc document conversion failed with error 99
Execution halted

---
title: "My Dashboard"
output: flexdashboard::flex_dashboard
---
  
### Chart 1

```{r}
library(readr)
library(haven)
library(shiny)

subs<-structure(list(Sold_Pr = c(6500, 173000, 60000, 73000, 155000, 
105000, 140000, 39900, 73500, 46000, 99900, 180000, 164000, 120000, 
206000, 160000, 67400, 215000, 145000, 175000, 350000, 425000, 
435000, 490000, 545000, 585000), Area = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("411", "415", "981", 
"8001", "8002", "8003", "8004", "8005", "8006", "8007", "8008", 
"8009", "8010", "8011", "8012", "8013", "8014", "8015", "8016", 
"8017", "8018", "8019", "8020", "8021", "8022", "8023", "8024", 
"8025", "8026", "8027", "8028", "8029", "8030", "8031", "8034", 
"8035", "8037", "8038", "8039", "8040", "8041", "8042", "8043", 
"8044", "8045", "8046", "8047", "8048", "8049", "8050", "8051", 
"8052", "8053", "8055", "8056", "8057", "8058", "8059", "8060", 
"8061", "8062", "8063", "8064", "8065", "8066", "8067", "8068", 
"8069", "8070", "8071", "8072", "8073", "8074", "8075", "8076", 
"8077"), class = "factor"), Closed_Date = structure(c(18668, 
18933, 18716, 18740, 18639, 18845, 18708, 18676, 18733, 18695, 
18715, 18709, 18794, 18803, 18750, 18787, 18906, 18810, 18855, 
18870, 18626, 18786, 18808, 18864, 18961, 18914), class = "Date")), row.names = c(NA, 
-26L), class = c("tbl_df", "tbl", "data.frame"))

selectInput("ar", label = "Select Area:",
            choices =unique(subs$Area), selected = unique(subs$Area)[1])

```

最佳答案

不知道这个问题的原因是什么。可能与支持更新版本的 Bootstrap 的持续努力有关。无论如何,您可以通过指定要在 YAML 中使用的 Bootstrap 版本来使代码正常工作(另请参阅此 vignette ):

注意:我还必须指定 bootswatch 主题才能获得默认的 flexdashboard 外观。

---
title: "My Dashboard"
output: 
  flexdashboard::flex_dashboard:
    theme:
      version: 3
      bootswatch: cosmo
---
  
### Chart 1

```{r}
library(readr)
library(haven)
library(shiny)

subs <- structure(list(Sold_Pr = c(
  6500, 173000, 60000, 73000, 155000,
  105000, 140000, 39900, 73500, 46000, 99900, 180000, 164000, 120000,
  206000, 160000, 67400, 215000, 145000, 175000, 350000, 425000,
  435000, 490000, 545000, 585000
), Area = structure(c(
  1L, 1L, 1L,
  1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
  1L, 2L, 2L, 2L, 2L, 2L, 2L
), .Label = c(
  "411", "415", "981",
  "8001", "8002", "8003", "8004", "8005", "8006", "8007", "8008",
  "8009", "8010", "8011", "8012", "8013", "8014", "8015", "8016",
  "8017", "8018", "8019", "8020", "8021", "8022", "8023", "8024",
  "8025", "8026", "8027", "8028", "8029", "8030", "8031", "8034",
  "8035", "8037", "8038", "8039", "8040", "8041", "8042", "8043",
  "8044", "8045", "8046", "8047", "8048", "8049", "8050", "8051",
  "8052", "8053", "8055", "8056", "8057", "8058", "8059", "8060",
  "8061", "8062", "8063", "8064", "8065", "8066", "8067", "8068",
  "8069", "8070", "8071", "8072", "8073", "8074", "8075", "8076",
  "8077"
), class = "factor"), Closed_Date = structure(c(
  18668,
  18933, 18716, 18740, 18639, 18845, 18708, 18676, 18733, 18695,
  18715, 18709, 18794, 18803, 18750, 18787, 18906, 18810, 18855,
  18870, 18626, 18786, 18808, 18864, 18961, 18914
), class = "Date")), row.names = c(
  NA,
  -26L
), class = c("tbl_df", "tbl", "data.frame"))
```                                                          
                                                                  
```{r, eval=TRUE}
selectInput("ar",
  label = "Select Area:",
  choices = unique(subs$Area), selected = unique(subs$Area)[1]
)
```

enter image description here

关于r - 尝试将 selectInput() 添加到 flexdashboard 时 Pandoc 文档转换失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70435453/

相关文章:

r - 错误 : argument "mainPanel" is missing, 无默认值

r - crosstalk的filter_select不会过滤图表

r - 根据 R 中另一个数据帧的条件对 data.frame 中的列求和

python - 从 Python 到 R 的 if-else 函数

r - 通过两次拟合提升树来获得不同的值

r - 将 R Markdown 发布到 Wordpress 时,不在 shorttag 中对内容进行 html 编码

r - 如何在另一个observeEvent中创建动态数量的observeEvent?

r Shiny 的表不呈现html

降低 flexdashboard/storyboard 中框架的高度

css - 在 Flexdashboard 中更改激活页面的颜色