<server.R>
library(shiny) # Define Server Function server <- function(input, output) { output$selected_value <- renderText({input$slider}) output$selected_option <- renderText({input$dropdown}) output$selected_date <- renderText({input$date}) output$txtout <- renderText({ paste(input$txt1, input$txt2, input$txt3, input$txt4, input$txt5, input$txt6, input$txt7, input$txt8, sep = " " ) }) output$plot <- renderPlot({ ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() }) } |
<ui.R>
# Loading the libraries library(shiny) library(shinythemes) library(ggplot2) #UI Defined ui <- fluidPage(theme = shinytheme("superhero"), navbarPage( # mainPanel "Welcome to INFO", # Tab 1 tabPanel("Tab 1", mainPanel( tags$h3("Register to INFO:"), textInput("txt1", "Name:", ""), textInput("txt2", "Surname:", ""), textInput("txt3", "Email:", ""), textInput("txt4", "Mobile.No:", ""), textInput("txt5", "Education:", ""), textInput("txt6", "College:", ""), textInput("txt7", "Programming Language:", ""), textInput("txt8", "Area of Interest:", ""), hr(), h4("Here is your Details"), verbatimTextOutput("txtout"), )), # TabPanel tabPanel("Tab 2", h3("Hello !! Here is the Plot Graph, Slider, Dropdown and Date picker!!!"))), hr(), ( plotOutput("plot") #PlotGraph ), hr(), sidebarPanel( sliderInput("slider", "Select a value:", min = 10, max = 500, value = 125), selectInput("dropdown", "Select an option:", c("R", "JAVA", "C++")), dateInput("datepicker", "Select a date:"), ),#SidebarPanel mainPanel( h3("Selected values:"), textOutput("selected_value"), textOutput("selected_option"), textOutput("selected_date"), ) ) |
Shiny Tutorial
This is a shiny tutorial.
bookdown.org