能够从Shiny中选择将包含在生成的RmarkDown报告中

发布于 2025-02-01 03:37:52 字数 551 浏览 2 评论 0原文

在我使用的闪亮框架中,用户可以直接从具有不同格式类型(PDF,HTML,Word)的闪亮生成报告。有一个textaareainput(),您可以在其中编写reprotot的描述,如果没有描述,则由于RRMarkDown中的以下代码,该报告仍将生成。

{r, results='asis',echo=F}
if(nchar(params$description) > 1){ # If there was a description specified, add it to the report
cat('\n**Description:**\n')
cat(input$description)
}

还有可能生成图的可能性,如果没有闪亮的绘图,则不会呈现报告,并且会出现错误,因为没有“ Graph()”,

{r 2 plot, echo=FALSE, fig.cap= 'Plot 1}
graph()

所以我的问题是,是否有与“ if”(nchar())类似的反应功能类似的东西,即使没有生成的图,报告的其余部分仍然会呈现? 感谢您提前提供的帮助。

In a shiny framework that I am using, the user has the ability to generate reports directly from the shiny with different format types(pdf, HTML, word). There is a textAreaInput() where you can write a description for the reprot and if there is no description, the report will still be generated due to the following code in rrmarkdown.

{r, results='asis',echo=F}
if(nchar(params$description) > 1){ # If there was a description specified, add it to the report
cat('\n**Description:**\n')
cat(input$description)
}

There is also the possibility to generate plots, and if there is no plot generated in the shiny, then the report won't be rendered and it will give an error since there is no "graph()"

{r 2 plot, echo=FALSE, fig.cap= 'Plot 1}
graph()

So my question is, is there something similar to "if(nchar())" for reactive function so even if there is no generated plot, the rest of the report will still be rendered?
thanks for all help in advance.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文