Skip to content

Instantly share code, notes, and snippets.

@chasemc
Last active June 22, 2020 18:02
Show Gist options
  • Save chasemc/ac8cdb72bb80e68328491bb448b595d3 to your computer and use it in GitHub Desktop.
Save chasemc/ac8cdb72bb80e68328491bb448b595d3 to your computer and use it in GitHub Desktop.
server <- function(input, output, server) {
output$out <- renderText({
validate(
need(input$x < 0, "x can not be negative"),
need(input$trans %in% c("log", "square-root"), "trans blah blah")
)
switch(input$trans,
square = input$x ^ 2,
"square-root" = sqrt(input$x),
log = log(input$x)
)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment