Wikki13 commited on
Commit
44e13d1
1 Parent(s): 356380d

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +68 -68
app.R CHANGED
@@ -1,69 +1,69 @@
1
- library(shiny)
2
- library(shinythemes)
3
- library(readxl)
4
- library(ggplot2)
5
- motor_data <- read_excel("D:/DS/R/Zygote_R/india_vehicle_sales_trends.xlsx")
6
- ui <- fluidPage(
7
- theme = shinytheme("cyborg"),
8
- #shinythemes::themeSelector(),
9
- navbarPage(
10
- "Wikki Zygote",
11
- tabPanel("Home",
12
- sidebarPanel(
13
- tags$h3("Input:"),
14
- textInput("txt1", "Given Name:", ""),
15
- textInput("txt2", "Surname:", ""),
16
- tags$p("Play around this input boxes, its fun which covers concept of Reactive expressions in Shiny R")
17
- ), #sidebar panel
18
- mainPanel(
19
- h1("Welcome to Wikki Zygote"),
20
- verbatimTextOutput("txtout"),
21
- ) #main panel
22
- ), #panel 1 end
23
- tabPanel("Motor Sales India",
24
- sidebarLayout(
25
- sidebarPanel(
26
- tags$p("This is a bar plot against Indian Motor sales from 2010 to 2019 using Shiny R library")
27
- ),
28
- mainPanel(
29
- plotOutput(outputId = "distPlot")
30
- ),
31
-
32
- )
33
- ),
34
- tabPanel("Dashboard", "This panel is under development"),
35
- tabPanel("About me",
36
- "Wikki Zygote Web application using Shiny R")
37
- )
38
- )
39
-
40
- server <- function(input, output){
41
- output$txtout <- renderText({
42
- paste(input$txt1, input$txt2, sep = " ")
43
- })
44
- output$distPlot <- renderPlot({
45
-
46
- # x <- motor_data$`Total (million)`
47
- # bins <- seq(min(x), max(x), length.out = input$bins + 1)
48
-
49
- # hist(x, breaks = bins, col = "blue", border = "black",
50
- # xlab = "Sales",
51
- # main = "Histogram of Indian Motor Sales")
52
-
53
- # hist(x,
54
- # main = "Histogram of Total Vehicle Production",
55
- # xlab = "Total Vehicle Production (Millions)",
56
- # col = "lightblue",
57
- # border = "black")
58
-
59
- #bar plot
60
- ggplot(motor_data, aes(x = Year, y = `Total (million)`)) +
61
- geom_bar(stat = "identity", fill = "steelblue") +
62
- scale_y_continuous(breaks = seq(0, 26, by = 2), labels = seq(0, 26, by = 2)) +
63
- labs(title = "Passenger Vehicle Production Over the Years",
64
- x = "Year",
65
- y = "Production (Millions)")
66
- })
67
- }
68
-
69
  shinyApp(ui = ui, server = server)
 
1
+ library(shiny)
2
+ library(shinythemes)
3
+ library(readxl)
4
+ library(ggplot2)
5
+ motor_data <- read_excel("/india_vehicle_sales_trends.xlsx")
6
+ ui <- fluidPage(
7
+ theme = shinytheme("cyborg"),
8
+ #shinythemes::themeSelector(),
9
+ navbarPage(
10
+ "Wikki Zygote",
11
+ tabPanel("Home",
12
+ sidebarPanel(
13
+ tags$h3("Input:"),
14
+ textInput("txt1", "Given Name:", ""),
15
+ textInput("txt2", "Surname:", ""),
16
+ tags$p("Play around this input boxes, its fun which covers concept of Reactive expressions in Shiny R")
17
+ ), #sidebar panel
18
+ mainPanel(
19
+ h1("Welcome to Wikki Zygote"),
20
+ verbatimTextOutput("txtout"),
21
+ ) #main panel
22
+ ), #panel 1 end
23
+ tabPanel("Motor Sales India",
24
+ sidebarLayout(
25
+ sidebarPanel(
26
+ tags$p("This is a bar plot against Indian Motor sales from 2010 to 2019 using Shiny R library")
27
+ ),
28
+ mainPanel(
29
+ plotOutput(outputId = "distPlot")
30
+ ),
31
+
32
+ )
33
+ ),
34
+ tabPanel("Dashboard", "This panel is under development"),
35
+ tabPanel("About me",
36
+ "Wikki Zygote Web application using Shiny R")
37
+ )
38
+ )
39
+
40
+ server <- function(input, output){
41
+ output$txtout <- renderText({
42
+ paste(input$txt1, input$txt2, sep = " ")
43
+ })
44
+ output$distPlot <- renderPlot({
45
+
46
+ # x <- motor_data$`Total (million)`
47
+ # bins <- seq(min(x), max(x), length.out = input$bins + 1)
48
+
49
+ # hist(x, breaks = bins, col = "blue", border = "black",
50
+ # xlab = "Sales",
51
+ # main = "Histogram of Indian Motor Sales")
52
+
53
+ # hist(x,
54
+ # main = "Histogram of Total Vehicle Production",
55
+ # xlab = "Total Vehicle Production (Millions)",
56
+ # col = "lightblue",
57
+ # border = "black")
58
+
59
+ #bar plot
60
+ ggplot(motor_data, aes(x = Year, y = `Total (million)`)) +
61
+ geom_bar(stat = "identity", fill = "steelblue") +
62
+ scale_y_continuous(breaks = seq(0, 26, by = 2), labels = seq(0, 26, by = 2)) +
63
+ labs(title = "Passenger Vehicle Production Over the Years",
64
+ x = "Year",
65
+ y = "Production (Millions)")
66
+ })
67
+ }
68
+
69
  shinyApp(ui = ui, server = server)