library(shiny); library(ggplot2); library(dplyr)
peloton <- read.csv("https://raw.githubusercontent.com/santanamv/Dev_Data_Prod_Final_Project/main/cycling%20peloton%20dataset%202020.csv")
ui <- fluidPage(
titlePanel("Some Analysis of My Cycling Data"),
sidebarLayout(
sidebarPanel(fluid = FALSE,
selectInput("Variable1","Variable 1:",
c("TotalOutput", "AvgWatts", "AvgCadence", "AvgSpeed")),
selectInput("Variable2","Variable 2:",
c("TotalOutput", "AvgWatts", "AvgCadence", "AvgSpeed")),
out = h5("Use the input selector for visual data analysis")),
mainPanel(
plotOutput("cyclingPlot"))))
server <- function(input, output) {
output$cyclingPlot <- renderPlot({
graph <- peloton %>% ggplot(aes(x = get(input$Variable1) , y = get(input$Variable2), color = peloton$Class)) +geom_point()
print(graph + labs(y=input$Variable1, x = input$Variable2, color = "Class Type"))})}
shinyApp(ui = ui, server = server)