Reputation: 337
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)
Upvotes: 3
Views: 1635
Reputation: 3488
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.
Upvotes: 3