I have trying to make an app that requires zip code input. I want to filter the data based on the targeted zip code the user provides and plot the time series forecast for housing data. I am at a loss and keep getting an error message in the plot box when I run the app. This is my first time working with Shiny and don't know the first step to getting the filtered data.
Also my "help" button gets me an error too if anyone can help with that. These features might be too unique for help from the internet.
library(shiny)
install.packages("shinydashboard")
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Market Prediction"),
dashboardSidebar(
actionButton("pdf", "Help"),
downloadButton("downloadData", "Market Analysis")),
dashboardBody(
box(plotOutput("market_analysis"), width = 8),
box(
selectInput("Zip_Code", "Enter Zip Code",
c(unique(Home_Clean1$RegionName))))
)
)
server <- function(input,output, session){
filteredData <- reactive({
filterPattern <- input$Zip_Code
filtered <- Home_Clean1[grep1(filterPattern, Home_Clean1$RegionName), ]
return(filtered)
})
output$market_analysis <- renderPlot({
plot(filtered ,aes(x = Monthly_parsed, y=Price/1000)) +
geom_line(color = "blue") +
xlab("Year") +
ylab ("Price in Thousands")+
ggtitle("House Prices Over Time") +
scale_x_date(date_labels = "%Y", breaks = "10 year") +
theme(axis.text.x = element_text(angle = 90,hjust = 1))
})
observeEvent(input$pdf, {
file.show("C:/Users/gorge/OneDrive/Document/OneDrive/Documents/DSC Capstone/Help.pdf"(R.home(), "doc", "Help.pdf"))
})
}
shinyApp(ui, server)`