You would just need to add on top of the table output within mainPanel
, something like this (I used the skimr
package for displaying the table stats.
library(shiny)
library(tidyverse)
library(DT)
#>
#> Attaching package: 'DT'
#> The following objects are masked from 'package:shiny':
#>
#> dataTableOutput, renderDataTable
library(skimr)
sales_vec = round(runif(1000,min = 50, max = 3500))
my_tibble = tibble(Var = 1:1000, Sales = sales_vec)
ui <- fluidPage(
sidebarLayout(sidebarPanel = sidebarPanel(
selectInput("select_nothing", "This does nothing", choices = LETTERS[1:10])
),
mainPanel = mainPanel(
h4('Table Stats'),
DT::dataTableOutput("my_summary"),
br(),
br(),
h4('Table View'),
DT::dataTableOutput("my_table")
))
)
server <- function(input, output, session) {
output$my_table = renderDT({
datatable(my_tibble)
})
output$my_summary = renderDT({
datatable(skim(my_tibble), options = list(dom = "t"))
})
}
shinyApp(ui, server)
Shiny applications not supported in static R Markdown documents
Created on 2020-08-13 by the reprex package (v0.3.0)