如何将闪亮的应用程序嵌入到 Rmarkdown html 文档中 [英] How to embed a shiny application into an Rmarkdown html document
问题描述
我想用 RMarkdown 创建一个 html 文档,其中包含文本、Rcode 以及介于闪亮应用程序之间的某个位置.
- 我想对
shinyApp(ui, server)
块使用asis=TRUE
,但 RStudio 只呈现 Rmd 文件,如果我添加runtime:闪亮
到YAML-Header. - 如果这样做,则不会创建 html,但我可以转到浏览器视图.
- 如果我在浏览器视图中查看源代码,我仍然看不到完整的 html 代码.
- 如果我检查生成的临时文件,我无法找到代表整个 RMarkdown 文档的 html 文件.
如何从shinyApp 函数生成html 代码?或者:如何从包含闪亮应用程序的 RMarkdown 生成 html 文件,而不是例如一个情节
我希望你对我有所了解.
我不太明白您所说的闪亮的应用程序"是什么意思.如果您已经设置了服务器端应用,即其他人可以通过 url 评估您的应用,您可以尝试以下方法.
见
I would like to create an html document with RMarkdown, containing text, Rcode and somewhere in between a shiny application.
- I thought of using
asis=TRUE
for theshinyApp(ui, server)
block, but RStudio only renders the Rmd file, if I addruntime: shiny
to the YAML-Header. - If I do so, no html is created, but I can move to browser view.
- If I look at the source code in the browser view , I still don't see the entire html code.
- If I check the generated temporary file, I was not able to find the html file representing the entire RMarkdown document.
How to generate html-code from the shinyApp function? Or: How to generate an html file, from RMarkdown containing a shiny app instead of e.g. a plot
I hope you have some idea for me.
I don't really understand what you mean by "a shiny application". If you have already set up a server side application, i.e. others can assess your application via url, you can try the following approach.
see https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html, second paragraph
A related function is
knitr::include_app()
, which is very similar toinclude_url()
, and it was designed for embedding Shiny apps via their URLs in the output.
这篇关于如何将闪亮的应用程序嵌入到 Rmarkdown html 文档中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!