Last active
November 10, 2020 14:55
-
-
Save dataprofessor/f9dc9d878e97e907aae807b6345433e4 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
# Load R packages | |
library(shiny) | |
library(shinythemes) | |
# Define UI | |
ui <- fluidPage(theme = shinytheme("cerulean"), | |
navbarPage( | |
"My first app", | |
tabPanel("Navbar 1", | |
sidebarPanel( | |
tags$h3("Input:"), | |
textInput("txt1", "Given Name:", ""), | |
textInput("txt2", "Surname:", "") | |
), # sidebarPanel | |
mainPanel( | |
h1("Header 1"), | |
h4("Output 1"), | |
verbatimTextOutput("txtout") | |
) # mainPanel | |
), # Navbar 1, tabPanel | |
tabPanel("Navbar 2", "This panel is intentionally left blank"), | |
tabPanel("Navbar 3", "This panel is intentionally left blank") | |
) # navbarPage | |
) # fluidPage | |
# Define server function | |
server <- function(input, output) { | |
output$txtout <- renderText({ | |
paste( input$txt1, input$txt2, sep = " " ) | |
}) | |
} | |
# Create Shiny object | |
shinyApp(ui = ui, server = server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment