Created
November 9, 2013 19:25
-
-
Save anonymous/7388846 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
) | |
} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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