闪亮的哪个锤子? 直的闪亮的,柔性仪表板还是闪亮的仪表板?

冒着被 国防部“太宽泛的问题”锤子击中的风险,我想问一下,鉴于大量的交互式 R Shiny工具和软件包的出现,你什么时候使用哪一个?

  1. Shiny -对我来说,你的项目只需要从 Shiny server 运行,但似乎是最好的选择。

  2. Shinydashboard -Shiny 但是有很好的标注值框。

  3. Flexdashboard -在 Rmd 发布。这对你有什么好处,而闪亮没有?也许,如果你愿意传递数据,给客户发电子邮件是有用的?我一直在使用 flexdashboard,但是它不能使用可数据表(库(Library,DT)) ,这让我觉得它需要更多的迭代。

看看其他的答案,我不是唯一的 问这个问题

创建者提供了很多画廊来展示他们的软件包/方法,但是你怎么知道该走哪条路呢?

使用一种方法比使用另一种方法有什么明显的优势?

14209 次浏览

There's one nuance that needs to be made. Interactivity does not necessarily require a server behind it running code. Interactivity can be provided using embedded JavaScript, which would execute at the client-side (like plotly, highcharts, leaflet etc). So if we don't use the word "interactivity", but describe the interactivity explicitly, then your options become:

  • Shiny: Needs a server behind it to execute R code on user input. Can implement any layout. Can run interactive code either by processing serverside (in R) or clientside (in embedded JavaScript).
  • shinydashboard:Needs a server behind it to execute R code on user input. Can implement a dashboard layout. Contains some specific widgets designed to work in a dashboard layout. Can run interactive code either by processing serverside (in R) or clientside (in embedded JavaScript).
  • flexdashboard: Just a document that looks like a dashboard. Also contains some specific widgets designed to work in a dashboard layout. Can only run interactive code clientside (in embedded JavaScript).

So basically, if whatever interactivity is required can be offered by an existing package (that uses htmlwidgets), then you can just use flexdashboard and you don't need to deploy it to any Shiny server. Otherwise, you do need to deploy to a Shiny server and you should use either Shiny, or shinydashboard.

I do not agree that you need to have Shiny Server to run a shiny app. I simply host my shiny app on our server at port 5050 (behind firewall) and any client can access the app via ip:port. I am only running 1 session of RStudio to accomplish this.

If I were to turn on port forwarding through our router, this app would also be accessible over the internet- but for security reasons I do not allow this.

I like the flexibility that Shiny offers to customize the web page.

ShinyDashboard is great in that it provides a commercial appearance without having to write all of the css and html yourself.

Flexdashboard is also nice in that you may be hosting it on a service that can handle markdown rather than inserting the app via an iFrame or something else.

I like to put shiny modules inside a flexdashboard. As long as you put runtime: shiny in your YAML header section, using shiny modules should be relatively straightforward. By relative, I mean, take a day and read over all the examples from RStudio, then try to do the same with your code. Once you're over the learning curve, modules in flexdashboards make future development much more streamlined, mentally easy, and in my experience, afford me the opportunity to really focus on the underlying data-based questions I've been asked to address. I think flexdashboards + shiny modules is the best of both worlds: flexdash to break up some of the layout items, easily add or remove a section of code, isolate various aspects of your application code in a more visually distinct layout (the shading of 'chunks' in an RMD file, etc.), while still allowing you to get into more complex, quintessentially shiny things like setting up observers, proxies, or custom layouts.

  1. shinydashboard has better UI elements than default shiny, but it's just like a modern theme. I don't think it should be listed as competitor to other 2.
  2. flexdashboard is just enhanced RMarkdown, using simple convention for UI arrangement, htmlwidgets etc. You can use Shiny in it but it's limited.
  3. To use Shiny you will need to write more code for UI and behavior, learn more things related to html, css, especially reactive which need some time to grasp. In the end you get all the power and controls.