tableOutput
uiOutput
(a.k.a. htmlOutput
), align
, . .
library(shiny)
server <- function(input, output, session) {
output$table_wrapped = renderUI({
reactiveTable = data.frame(
name=sapply(1:input$nrows, function(x) paste(
rep(letters[x], x),
collapse=''))
)
for( i in 1:input$ncols )
reactiveTable[letters[i]] = seq(100, 100*input$nrows, by = 100)
align = paste(rep('l', ncol(reactiveTable)))
numeric_columns = which(as.logical(lapply(reactiveTable, is.numeric)))
align[numeric_columns] = "r"
align = paste(align, collapse ="")
output$table <- renderTable({reactiveTable}, align = align)
tableOutput('table')
})
}
ui <- fluidPage(
inputPanel(
sliderInput("ncols", "Number of numeric columns", 4, 10, 4),
sliderInput("nrows", "Number of rows", 4, 10, 4)
),
uiOutput('table_wrapped')
)
runApp(list(ui=ui, server=server))
![enter image description here](https://fooobar.com/undefined)