r语言 - 使用"shinyAppDir"函数在单个 Rmarkdown 文件中嵌入多个闪亮的应用程序



我已经创建了几个闪亮的应用程序嵌入在单个Rmarkdown文件。我正在使用亚马逊ec2 Ubuntu机器来托管我的闪亮应用程序和rstudio。所有可用的应用程序都在/srv/shine -server.

为此,我在/srv/shine -server中为Rmarkdown单个文件创建了另一个文件夹。单个块正在运行,但运行文档命令给出错误:

错误:cannot open connection

我使用以下R降价代码:

### App 1 goes here
    ```{r, echo=FALSE}
library(shiny)
shinyAppDir(
  "/srv/shiny-server/App1",
  options=list(
    width="100%", height=550
  )
)
```
### App 2 goes here
    ```{r, echo=FALSE}
library(shiny)
shinyAppDir(
  "/srv/shiny-server/App2",
  options=list(
    width="100%", height=550
  )
)
```
## Likewise ...

不确定这将回答你的问题,但我遇到了这个问题,这是我发现的。我在Ubuntu EC2实例上运行一个闪亮的服务器。此外,我没有像你那样创建闪亮的应用程序,而是使用ggvis和闪亮的运行时在R Markdown中嵌入交互式可视化,如下所示:

---
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
  html_document:
    theme: readable
    toc: yes
    toc_depth: 3
runtime: shiny
---

下面是引起我的问题的两件事:

    到源代码或数据的路径错误。您可以提供绝对路径或相对于Rmd所在位置的路径。
  1. 在代码块中使用cache = TRUE

你不能缓存东西,当你这样做时,它会导致"cannot open the connection"错误。

相关内容

最新更新