Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. flat_model flat_type remaining_lease resale_price
  2. 1 MODEL A 5 ROOM 70 200000
  3. 2 MODEL A 3 ROOM 70 64300
  4. 3 MODEL A 3 ROOM 70 60000
  5. 4 MODEL A 3 ROOM 70 59000
  6. 5 MODEL A 4 ROOM 70 78000
  7. 6 MODEL A 4 ROOM 70 104000
  8.  
  9. library("shiny")
  10. library('ggplot2)
  11. ui <- fluidPage(
  12. titlePanel("Average Resale Price for Model A houses has decline sharply by 50% when remaining lease years for model A houses starts reaching below 93 and 77 years "),
  13. sidebarLayout(
  14. sidebarPanel(
  15. selectInput("room","Rooms",choices=c("All","2 ROOM","3 ROOM","4 ROOM","5 ROOM"),selected = "All")
  16. ),
  17. mainPanel(tabsetPanel(type="tab","Plot",plotOutput(outputId = "lineChart"))
  18. )
  19. ))
  20.  
  21.  
  22.  
  23. # Define server logic required to draw a line graph ----
  24.  
  25. server <- function(input, output, session){
  26. df1<-reactive({
  27. if(input$room =="All"){
  28. modeladata1%>%
  29. dplyr::filter(flat_type %in% c("2 ROOM","3 ROOM","4 ROOM","5 ROOM") )
  30. }
  31.  
  32. else{
  33. headlinedata%>%
  34. dplyr::filter(flat_type %in% input$room)
  35. }
  36. })
  37.  
  38. output$lineChart <- renderPlot({
  39. ggplot(data = df1(),aes(x=df1$remaining_lease,y=df1$resale_price))+
  40. geom_smooth()
  41. })
  42. }
  43.  
  44.  
  45. # Create Shiny object
  46. shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement