#author: "Yatharth Garg"
title: "SARAL"
output:
flexdashboard::flex_dashboard:
social: menu
source_code: embed
#orientation: rows
vertical_layout: scroll
theme: united #cerulean
logo: favicon-32x32.png
runtime: shiny
library(tidyverse)
library(forecast)
library(highcharter)
library(DT)
startData <- read.csv(file.choose())
GBChoices <- as.list(names(startData))
names(GBChoices) <- paste(names(startData),map(startData,~length(unique(.x))))
updateData <- reactive(
startData %>% group_by(!!! rlang::syms(input$GB)) %>% summarise_if(is.numeric,sum,na.rm=T))
Sidebar {.sidebar}
selectInput(inputId = "GB",label = "Group By",choices = GBChoices)
selectInput(inputId = "Metric",label = "Metric",choices = names(select_if(startData,is.numeric)))
Bar Graph
Column
Bar Graph
renderPlot({
updateData() %>%
ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +
geom_col()
})
Table
renderDT(
updateData(), rownames = F, extensions = 'Buttons', filter="top", editable=T,
options = list(
dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print'),
lengthMenu = list(c(10,50,100,-1),c(10,50,100,"All"))
)
)
Line Graph
Column
Line Graph
renderPlot({
updateData() %>%
ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +
geom_line()
})
Heat Map
Column
bin2d Graph
renderPlot({
updateData() %>%
ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +
geom_bin2d()
})
Point & Smooth graph
Column
Point Graph
renderPlot({
updateData() %>% ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +
geom_jitter()
})
Column
Smooth Graph
renderPlot({
updateData() %>% ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +geom_point(shape=1) +
geom_smooth()
})
BoxPlot
Column
BoxPLot
renderPlot({
updateData() %>% ggplot(aes(x=!! rlang::sym(input$GB),y=!! rlang::sym(input$Metric),fill=!! rlang::sym(input$GB))) +
geom_boxplot()
})