Skip to content

Instantly share code, notes, and snippets.

Created November 9, 2013 19:25
Show Gist options
  • Save anonymous/7388846 to your computer and use it in GitHub Desktop.
Save anonymous/7388846 to your computer and use it in GitHub Desktop.
# server.R
shinyServer(
function(input, output) {
# data frame with colnames
df <- data.frame(matrix(0, 1, 2))
colnames(df) <- c("First Column","Second Column")
# table with column headers
output$df <- renderTable({df}
, include.rownames = FALSE
, include.colnames = TRUE
, sanitize.text.function = function(x) x
)
# this one doesn't work
output$table <- renderTable({df}
, include.rownames = FALSE
, include.colnames = TRUE
, sanitize.text.function = function(x) x
)
}
)
# ui.R
library("shiny")
#library('devtools')
#install_github('shiny-incubator', 'rstudio')
library("shinyIncubator")
# initialize data with colnames
df <- data.frame(matrix(0, 1, 2))
colnames(df) <- c("First Column","Second Column")
shinyUI(
pageWithSidebar(
headerPanel('Simple matrixInput example')
,
sidebarPanel(
tableOutput(outputId = 'df')
,
matrixInput(inputId = 'data', label = 'Add/Remove Rows', data = df)
)
,
mainPanel(
tableOutput(outputId = 'table')
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment