Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output$bar3 <- renderPlotly({
- s <- CT_Data2 %>% filter(Sector == input$Sector & Airline == input$Airline1)
- d <- group_by(s, Booking.Month, Agency.Group)
- f <- summarize(d,num1 = sum(Bookings), num2 = sum(Pax))
- l = dcast(f, Booking.Month ~ Agency.Group, value.var= "num1")
- print(l)
- print(str(l))
- colNames <- names(l)[-1]
- print(colNames)
- p <- plotly::plot_ly()
- for(trace in colNames)
- {
- p <- p %>% plotly::add_trace(data = l,x = ~Booking.Month, y = ~trace, name = trace)
- }
- p %>% layout(title = "Trend Over Time",
- xaxis = list(title = ""),
- yaxis = list (title = "Value"),type='bar')
- })
- 'data.frame': 5 obs. of 3 variables:
- $ Booking.Month: chr "Aug" "Jul" "Jun" "Oct" ...
- $ Cleartrip : num NA NA NA 10 NA
- $ ROM : num 32 31 21 25 20
- Booking.Month Cleartrip ROM
- 1 Aug NA 32
- 2 Jul NA 31
- 3 Jun NA 21
- 4 Oct 10 25
- 5 Sep NA 20
Add Comment
Please, Sign In to add comment