3

我从 Shinygallery 借用了下面的代码并进行了一些更改。基本上这使用fluidPage. 我有兴趣使用flexdashboard. 我已经阅读了flexdashboard 用户指南。但是该网站上的描述是某种 rmarkdown 或 sweave 格式?我不熟悉。因此,如果我可以在没有降价或 sweave 的情况下看到此示例的 flexdashboard 版本,那么我可以轻松地与不同的组件相关联并在此基础上进行构建。任何提示或指针都受到赞赏的人。

library(shiny)
ui = shinyUI(fluidPage(
                mainPanel(
                 tabsetPanel(
                   tabPanel("Plot",plotOutput("plot1"),plotOutput("plot2")),
                   tabPanel("Summary",verbatimTextOutput("summary")),
                  tabPanel("Table",DT::dataTableOutput("table"))
                   ))))

server = shinyServer(function(input, output, session) {
  output$plot1 <- renderPlot({
    plot(cars)
  })

  output$plot2 <- renderPlot({
    plot(iris)
  })

  output$summary <- renderPrint({
    summary(cars)
  })

  output$table <- DT::renderDataTable({
    DT::datatable(cars)
  })
})

shinyApp(ui, server)
4

1 回答 1

3

我很快把这个放在一起。

不完美。但它通常可以完成工作(我必须下班,也许今晚晚些时候我会调整一下)

请注意,在这篇文章之前我也从未遇到过flexdashboard。我已经使用shinydashboard了很多,以及 RMarkdown,所以这绝对很有趣。不知道什么flexdashboard会真正为我个人增加shinydashboard,但我肯定会再玩一些。

反正...

---
title: "Test App"
output: flexdashboard::flex_dashboard
---

Plot
=====================================  

row 
-------------------------------------


```{r}
library(shiny)
renderPlot({
  plot(cars)
})
```

row 
-------------------------------------

```{r}
renderPlot({
  plot(iris)
})
```   


Summary
=====================================     

```{r}   
renderPrint({
    summary(cars)
  })
```


Table
=====================================     

```{r}   
DT::renderDataTable({
    DT::datatable(cars)
  })
```

一个大问题是,当我调用行时,我要在一行而不是两个不同的行上找到两个图。我会玩得更远。

于 2016-05-20T18:57:31.487 回答