我有一个R markdown文件,希望它能在我们公司的Shiny服务器上使用。
根据R Markdown: The Definitive Guide,我可以在Rmd文件顶部的YAML元数据中添加
我的项目位于
R版本3.4.3,Shiny服务器版本1.5.6.875
更新3:因此,我在服务器上寻找Shiny Server的日志文件。我没有管理员特权,所以以前从未寻找过这个文件,但我找到了一个包括以下内容的日志文件:
更新4:事实证明,我的RHEL服务器是最新的;它已经拥有了bugfix建议的glib2版本。由于我仍然遇到这个错误,因此我的管理员将把这个问题升级到Red Hat。
更新5:Red Hat支持建议还有另一个glib2 so文件存在,事实证明确实如此。删除此文件解决了问题!
根据R Markdown: The Definitive Guide,我可以在Rmd文件顶部的YAML元数据中添加
runtime: shiny
将其转换为Shiny文档。我已经这样做了,并且它有效。如果我在RStudio中点击“Run Document”,它会运行Rmd文件,并且我可以看到报告,没有任何问题。我的项目位于
ShinyApps
目录中,Shiny服务器正在寻找要提供的应用程序。当我访问此项目的URL时,我只得到报告没有任何图表。图表应该在的地方只有破碎的图像图标。(我正在使用RStudio Server,因此RStudio和Shiny Server访问的是完全相同的文件)。R版本3.4.3,Shiny服务器版本1.5.6.875
更新:我使用最简单的例子重现了这种行为。我创建了一个名为TEST
的新RStudio项目,只是一个普通的项目,位于我的ShinyApps目录中。然后我创建了一个新的R Markdown文件,我称之为TEST.Rmd。此文件预填有使用内置数据集cars
和pressure
的示例RMarkdown。我更改了YAML标题以包括runtime: shiny
。预期情况下,RStudio的“编织”按钮被“运行文档”按钮替换,单击此按钮会运行文档并按预期工作。尝试通过Shiny Server查看页面时,存在相同的问题,即图表未包含在内;一个损坏的图像图标取而代之。
更新2:根据要求,这是Markdown文件。它实际上是由RStudio生成的示例文件,其中添加了runtime: shiny
到YAML标题中。
---
title: "Test RMarkdown"
author: "Michael Henry"
date: "4/6/2020"
output: html_document
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
更新3:因此,我在服务器上寻找Shiny Server的日志文件。我没有管理员特权,所以以前从未寻找过这个文件,但我找到了一个包括以下内容的日志文件:
/lib64/libpango-1.0.so.0: undefined symbol: g_log_structured_standard
。原来RHEL存在一个错误,有一个可用的修复程序,所以我已经向管理员提出了申请,请求应用修复程序。当修复程序被应用后,我会回报是否解决了我的问题。更新4:事实证明,我的RHEL服务器是最新的;它已经拥有了bugfix建议的glib2版本。由于我仍然遇到这个错误,因此我的管理员将把这个问题升级到Red Hat。
更新5:Red Hat支持建议还有另一个glib2 so文件存在,事实证明确实如此。删除此文件解决了问题!