Last active
August 29, 2015 14:26
-
-
Save ChrisBeeley/a2f1d88dfedcd2e1cb59 to your computer and use it in GitHub Desktop.
Minimal application for Shiny Book, 2nd edition
This file contains 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
library(shiny) # load Shiny at the top of both scripts | |
shinyServer(function(input, output) { # define application in here | |
output$textDisplay <- renderText({ # mark function as reactive | |
# and assign to output$textDisplay for passing to ui.R | |
paste0("You said '", input$comment, # from the text | |
"'. There are ", nchar(input$comment), # input control as | |
" characters in this.") # defined in ui.R | |
}) | |
}) |
This file contains 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
library(shiny) # load Shiny at the top of both files | |
shinyUI(fluidPage( # flexible layout function | |
# Title | |
titlePanel("Minimal application"), | |
sidebarLayout( # standard inputs on sidebar, outputs in main area layout | |
sidebarPanel( # sidebar configuration | |
textInput(inputId = "comment", # this is the name of the | |
# variable- this will be passed to server.R | |
label = "Say something?", # display label for the variable | |
value = "" # initial value | |
)), | |
# Show a plot of the generated distribution | |
mainPanel( # main output configuration | |
h3("This is you saying it"), # title with HTML helper | |
textOutput("textDisplay") # this is the name of the output | |
# element as defined in server.R | |
) | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment