I've been struggling for a few hours with such a task: in R Shiny I need to display a table which contains of a single column of integers with the definite (relatively large) spacing between rows.
There is the spacing
argument in the renderTable()
function, but even setting it to the biggest value 'l'
is still not enough for my purpose.
I've tried to do that using xtable and taking into account the example from Adjust row height xtable R , but with no result (I don't know CSS).
The most natural way I've found in the web is to use DT
package along with the Scroller
extension, but the following code still gives no results
ui.R:
fluidPage(
sidebarLayout(
sidebarPanel(
dataTableOutput('dtable', width = '50%') # argument 'height' does not work here
),
mainPanel()
)
)
server.R:
library(shiny)
library(DT)
function(input, output) {
output$dtable <- DT::renderDataTable({
data.frame(SSD = c(2, 17, 19, 35))
},
extensions = 'Scroller',
options = list(
dom = 't',
ordering = FALSE,
scroller = list(rowHeight = 100)
)
)
}
The output of that gives only column name (what is wrong??), but without Scroller
extensions it displays the expected table - of course with too small spacing...