"Hello, World" app output (UI/Server)
To finish up your "Hello, world" app, you'll have to actually display the text that's input.
Recall this is how you construct an output from an input:
# Render output y using input x
output$y <- renderText({
input$x
})
shiny
has been pre-loaded for you.
By the end of this exercise, your app should look like this:
If you get an error message resembling Parsing error in script.R:4:3: unexpected symbol
,
it is very likely that you have forgotten to use a comma to separate the
arguments to one of the functions.
This exercise is part of the course
Building Web Applications with Shiny in R
Exercise instructions
- Server: Create an output named
'greeting'
that displays "Hello, Kaelen" when Kaelen is input as the name. - UI:: Display the output in the UI. Be sure to add a comma after
textInput()
, before adding more code.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
ui <- fluidPage(
textInput("name", "What is your name?")
# CODE BELOW: Display the text output, greeting
# Make sure to add a comma after textInput()
)
server <- function(input, output) {
# CODE BELOW: Render a text output, greeting
}
shinyApp(ui = ui, server = server)