Is it possible to adjust the output of the Excel output? I would like to be able to do the following things in descending urgency.
- Add a Header to the table that includes some text "This table is based on the iris dataset and uses input$width as minimum"
- Add an Thick bottom border to the column names header
- Add a left border after the first column
- Add an empty row above the header
- Where I could write stuff into some merged cells, i.e. I would like to write "Petal Sizes" above the four columns of length, width,...
Thats a MWE using the button extension. I found some information for the original javascrtip DT here, but that is a bit too hard for me to transfer into R.
rm(list=ls())
library(shiny)
library(datasets)
library(DT)
library(data.table)
DT<-data.table(iris)
server<-shinyServer(function(input, output) {
output$view <- DT::renderDataTable(
DT[Sepal.Width<=input$width,.SD],extensions = c( 'FixedHeader','Buttons'),
options=list(pageLength=60,fixedHeader = TRUE,dom = 'Bfrtip',buttons = c( 'csv', 'excel' )))
})
ui<-shinyUI(fluidPage(
titlePanel("Shiny MWE"),
sidebarLayout(
sidebarPanel(
sliderInput("width", label = h3("Min width"),
min=min(DT$Sepal.Width), max=max(DT$Sepal.Width), value=mean(DT$Sepal.Width),
)),
mainPanel(
DT::dataTableOutput("view")
)
)
))
runApp(list(ui=ui,server=server))