Hello I am trying to create a Rshiny dashboard, I have done the following R script, but function error doesn't let the web page load and it crashes with the following error. Thank you I had to do R shiny for the first time for just a week as i took a wrong elective, this is the final assignment i need to complete to finish grad school, I've been trying different stuff to get it sorted but didnt reach anywhere for a week. If you have a little time on your hand and provide a little help for developing a quick dashboard with this dataset (nothing fancy just 2-3 page subitem for any type for analytical graphs, literally super basic), it would really really helpful.
Dataset:** Where it Pays to Attend College | Kaggle **
library(shiny)
library (shinydashboard)
library (shinythemes)
library (readr)
library (ggplot2)
library(shinyWidgets)
setwd("C:/")
degrees <- read.csv("C: /degrees-that-pay-back.csv", header = TRUE)
college <- read.csv("C: /salaries-by-college-type.csv", header = TRUE)
salaries <- read.csv("C:/ /salaries-by-region.csv", header = TRUE)
library(shiny)
library(shinyWidgets)
library(ggplot2)
library(dplyr)
ui <- fluidPage(
setBackgroundColor(color = c("#66e0ff", "#00a3cc", "#003d4d")),
titlePanel("Where does it pay to attend college?"),
sidebarLayout(
sidebarPanel(tags$style(".well {background-color:#e6f9ff;}"),
sliderInput(inputId = "range",
label = "Chose the year range:",
min = 30000, max = 1000000, value = c(30000,100000)),
selectInput(inputId = "dis",
label = "Chose the School type",
choices = unique(college$School.Type)),
checkboxGroupInput(inputId = "con",
label = "Region of the school ",
choices = unique(salaries$Region),
selected = unique(salaries$Region)[1])
),
mainPanel(plotOutput("graph1"))
)
)
server <- function(input, output){
df_dat <- observeEvent({
req(input$con, input$dis, input$range)
df_dat <- filter(degrees, between(degrees$Starting.Median.Salary, input$range[1], input$range[2]), college$School.Type == input$dis, salaries$Region %in% input$con)
return(df_dat)
})
observe(print(str(df_dat())))
# create a graph
output$graph1 <- renderPlot({
req(df_dat())
# plot filtered data
ggplot(df_dat(), aes(x = degrees$Starting.Median.Salary, y = college$School.Name)) +
geom_line(aes(colour = salaries$Region))+
geom_point()
})
}
shinyApp(ui = ui, server = server)