Spaces:
Sleeping
Sleeping
| library(shiny) | |
| library(shinythemes) | |
| library(readxl) | |
| library(ggplot2) | |
| motor_data <- readxl::read_excel("india_vehicle_sales_trends.xlsx") | |
| ui <- fluidPage( | |
| theme = shinytheme("cyborg"), | |
| #shinythemes::themeSelector(), | |
| navbarPage( | |
| "Wikki Zygote", | |
| tabPanel("Home", | |
| sidebarPanel( | |
| tags$h3("Input:"), | |
| textInput("txt1", "Given Name:", ""), | |
| textInput("txt2", "Surname:", ""), | |
| tags$p("Play around this input boxes, its fun which covers concept of Reactive expressions in Shiny R") | |
| ), #sidebar panel | |
| mainPanel( | |
| h1("Welcome to Wikki Zygote"), | |
| verbatimTextOutput("txtout"), | |
| ) #main panel | |
| ), #panel 1 end | |
| tabPanel("Motor Sales India", | |
| sidebarLayout( | |
| sidebarPanel( | |
| tags$p("This is a bar plot against Indian Motor sales from 2010 to 2019 using Shiny R library") | |
| ), | |
| mainPanel( | |
| plotOutput(outputId = "distPlot") | |
| ), | |
| ) | |
| ), | |
| tabPanel("Dashboard", "This panel is under development"), | |
| tabPanel("About me", | |
| "Wikki Zygote Web application using Shiny R") | |
| ) | |
| ) | |
| server <- function(input, output){ | |
| output$txtout <- renderText({ | |
| paste(input$txt1, input$txt2, sep = " ") | |
| }) | |
| output$distPlot <- renderPlot({ | |
| # x <- motor_data$`Total (million)` | |
| # bins <- seq(min(x), max(x), length.out = input$bins + 1) | |
| # hist(x, breaks = bins, col = "blue", border = "black", | |
| # xlab = "Sales", | |
| # main = "Histogram of Indian Motor Sales") | |
| # hist(x, | |
| # main = "Histogram of Total Vehicle Production", | |
| # xlab = "Total Vehicle Production (Millions)", | |
| # col = "lightblue", | |
| # border = "black") | |
| #bar plot | |
| ggplot(motor_data, aes(x = Year, y = `Total (million)`)) + | |
| geom_bar(stat = "identity", fill = "steelblue") + | |
| scale_y_continuous(breaks = seq(0, 26, by = 2), labels = seq(0, 26, by = 2)) + | |
| labs(title = "Passenger Vehicle Production Over the Years", | |
| x = "Year", | |
| y = "Production (Millions)") | |
| }) | |
| } | |
| shinyApp(ui = ui, server = server) |