12/2/2021

R Markdown

My Cycling Data & Github Repo

##   TotalOutput AvgWatts AvgResistance AvgCadence AvgSpeed
## 1         171       77          0.34         57    12.81
## 2         154       86          0.37         78    14.88
## 3         182      101          0.42         72    16.17
## 4          25       84          0.33         88    15.12
## 5         221       82          0.38         72    14.83
## 6          23       77          0.38         70    14.46

The data and the code can be found in my github repo: - https://github.com/santanamv/Dev_Data_Prod_Final_Project

The Code

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)