Skip to content

Instantly share code, notes, and snippets.

@ojessen
Last active January 4, 2016 09:49
Show Gist options
  • Save ojessen/8604593 to your computer and use it in GitHub Desktop.
Save ojessen/8604593 to your computer and use it in GitHub Desktop.
Testing NumericInput
require(shiny)
ui <- basicPage(
numericInput("test", "Input Number", value=2, min=0, max=5),
verbatimTextOutput("test_regression"),
tableOutput("session_info"),
tableOutput("shiny_info"),
verbatimTextOutput("test_alpha"),
tableOutput("test_df")
)
server <- function(session, input, output) {
output$test_regression <- renderText({
print(paste("Class",class(input$test), "value", tmp = input$test))
})
output$session_info = renderTable({
tmp = unlist(R.Version())
df = data.frame(name= names(tmp), value = tmp)
})
output$shiny_info = renderTable({
tmp = installed.packages()
shiny_row = tmp[which(rownames(tmp)=="shiny"),,drop = FALSE]
shiny_row[,!is.na(shiny_row[1,]),drop = FALSE]
})
output$test_alpha = renderText({
tmp = input$test
testClass = setClass("testClass", slots=list(alpha = "numeric"))
setMethod(initialize, "testClass", function(.Object, alpha){
.Object@alpha = alpha
.Object
})
newTmp = testClass(tmp)
newTmp@alpha
})
output$test_df = renderTable({
tmp = input$test
df = as.data.frame(tmp)
})
}
runApp(list(ui = ui, server = server), port = 4054)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment