Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- flat_model flat_type remaining_lease resale_price
- 1 MODEL A 5 ROOM 70 200000
- 2 MODEL A 3 ROOM 70 64300
- 3 MODEL A 3 ROOM 70 60000
- 4 MODEL A 3 ROOM 70 59000
- 5 MODEL A 4 ROOM 70 78000
- 6 MODEL A 4 ROOM 70 104000
- library("shiny")
- library('ggplot2)
- ui <- fluidPage(
- 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 "),
- sidebarLayout(
- sidebarPanel(
- selectInput("room","Rooms",choices=c("All","2 ROOM","3 ROOM","4 ROOM","5 ROOM"),selected = "All")
- ),
- mainPanel(tabsetPanel(type="tab","Plot",plotOutput(outputId = "lineChart"))
- )
- ))
- # Define server logic required to draw a line graph ----
- server <- function(input, output, session){
- df1<-reactive({
- if(input$room =="All"){
- modeladata1%>%
- dplyr::filter(flat_type %in% c("2 ROOM","3 ROOM","4 ROOM","5 ROOM") )
- }
- else{
- headlinedata%>%
- dplyr::filter(flat_type %in% input$room)
- }
- })
- output$lineChart <- renderPlot({
- ggplot(data = df1(),aes(x=df1$remaining_lease,y=df1$resale_price))+
- geom_smooth()
- })
- }
- # Create Shiny object
- shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement