library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rvest)
## 
## Attaching package: 'rvest'
## 
## The following object is masked from 'package:readr':
## 
##     guess_encoding
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(patchwork)
library(shiny)

CJM_Data <- read.csv("/Users/colinmcfetridge/Desktop/Data Visualization and Management/PlotTen(1)/CJM Basketball Data copy.csv")
ui <- fluidPage(
    tabPanel("Scatter plot",
             sidebarLayout(
               sidebarPanel(
                 textInput(inputId = "title1", label = "Plot title", 
                           placeholder = "Name of scatter plot"),
                 selectInput(inputId = "x_variable1", label = "X-axis variable", 
                             choices = names(CJM_Data)),
                 selectInput(inputId = "y_variable1", label = "Y-axis variable", 
                             choices = names(CJM_Data)),
                 radioButtons(inputId = "color1", "Scatter plot point color", 
                              choices = c("tan1", "skyblue2", "mediumseagreen", 
                                          "khaki1", "palevioletred"))),
               mainPanel(
                 plotOutput("scatterplot")
               )
             )
    ),)
server <- function(input, output) {
  
  output$scatterplot <- renderPlot({
    ggplot(CJM_Data, aes_string(x=input$x_variable1, y=input$y_variable1))+
      geom_point(color = input$color1)+
      geom_smooth(method = "lm", se = F, color = input$color1)+
      ggtitle(input$title1)+
      xlab(input$x_variable1)+
      ylab(input$y_variable1)+
      theme_classic()+
      theme(text = element_text(family = "Times New Roman"),
            plot.title = element_text(hjust = 0.5))
  })}

shinyApp(ui, server)
## PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
Shiny applications not supported in static R Markdown documents