I would like to create an html document with RMarkdown, containing text, Rcode and somewhere in between a shiny application.
我想創建一個帶有RMarkdown的html文檔,其中包含文本、Rcode和一個閃亮的應用程序之間的某個地方。
I thought of using asis=TRUE for the shinyApp(ui, server) block, but RStudio only renders the Rmd file, if I add runtime: shiny to the YAML-Header.
我想對shinyApp(ui,服務器)塊使用asis=TRUE,但是RStudio只渲染Rmd文件,如果我在YAML-Header中添加運行時:閃亮。
If I do so, no html is created, but I can move to browser view.
如果這樣做,就不會創建html,但是我可以轉移到瀏覽器視圖。
If I look at the source code in the browser view , I still don't see the entire html code.
如果我查看瀏覽器視圖中的源代碼,我仍然看不到整個html代碼。
If I check the generated temporary file, I was not able to find the html file representing the entire RMarkdown document.
如果檢查生成的臨時文件,則無法找到表示整個RMarkdown文檔的html文件。
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
如何從shinyApp函數生成html代碼?或者:如何從RMarkdown中生成一個html文件,其中包含一個閃亮的應用程序,而不是一個圖表
I hope you have some idea for me.
我希望你能給我一些建議。
2 个解决方案
#1
1
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.
我真的不明白你所說的“閃亮的應用”是什么意思。如果您已經建立了一個服務器端應用程序,例如其他人可以通過url評估您的應用程序,您可以嘗試以下方法。
見https://bookdown.org/yihui/bookdown/web-pages-and-shiny-apps.html,第二段
A related function is knitr::include_app(), which is very similar to include_url(), and it was designed for embedding Shiny apps via their URLs in the output.
一個相關的函數是knitr: include_app(),它與include_url()非常相似,它的設計目的是通過應用程序的url在輸出中嵌入閃亮的應用程序。
#2
1
If I understand your question correctly then maybe the following URL could be of help for you:
如果我正確地理解了您的問題,那么下面的URL可能會對您有所幫助:
http://rmarkdown.rstudio.com/authoring_shiny.html
As you can see in the example (at the top, under "Overview") you have to include a standard r code snippet in your RMarkdown document where you can write your shiny code.
正如您在示例(在頂部的“Overview”下)中看到的,您必須在您的RMarkdown文檔中包含一個標准的r代碼片段,您可以在其中編寫閃亮的代碼。
You don't have to follow the Shiny skeleton template. The only thing to do: You have to add the line runtime: shiny into the YAML-header and publish the .Rmd file in the normal way.
您不必遵循閃亮的骨架模板。惟一要做的事情是:必須將行運行時添加到YAML-header中,並以正常方式發布. rmd文件。
I hope this is helpful.
我希望這能有所幫助。