3

I borrowed this code below from the shinygallery and made some changes. Basically this uses fluidPage. I am interested in redoing the same thing using flexdashboard . I have gone through the flexdashboard userguide. but the descriptions on that website are in some rmarkdown or sweave format ?? which I am not familiar with. So if I can see the flexdashboard version of this example without the markdown or sweave then i can easily relate to different components and build on that. Any tips or pointers are appreciated folks.

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)
missy morrow
  • 337
  • 3
  • 16

1 Answers1

3

I quickly put this together.

Not perfect. But it generally gets the job done (and I have to leave work, maybe I'll fine tune later tonight)

Note that I also had never come across flexdashboard before this post. I had used shinydashboard quite a bit, as well as RMarkdown, so this is definitely interesting. Not sure what flexdashboard will really add for me personally over and above shinydashboard, but I'm definitely going to play with it some more.

Anyway...

---
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)
  })
```

The one big issue being that while I'm calling row, I'm getting to the two plots on a single row instead of two different rows. I will play further.

Andrew Taylor
  • 3,438
  • 1
  • 26
  • 47
  • 1
    thanks Andrew it worked for some reason the datatable is not opening for me in the last tab. I will dig into this. – missy morrow May 20 '16 at 19:39
  • 1
    You may need a `library(DT)` in setup section. But this does seem to be a problem [issue in flexdashboard](https://github.com/rstudio/flexdashboard/issues/28) which I see @missy has raised. – micstr Jun 23 '16 at 09:37