...I need assistance with modifying a window of an app in shiny. The app window only uses half of the page.. I have tried everything to adjust the size to where the app would utilize the whole window and nothing is working. Maybe someone has a resolution. attached is a picture.. also
Here is copy of code library(shiny)
library(DT)
library(aqsr)
library(leaflet)
library(dplyr)
library(httr)
Assuming you have loaded your data as aqs_monitors and ASOS_Stations
ASOS_Stations$WBAN <- as.integer(ASOS_Stations$WBAN)
ASOS_Stations$WBAN <- sprintf("%05d", ASOS_Stations$WBAN)
ASOS_Stations <- dplyr::filter(ASOS_Stations, CTRY == 'US' & !is.na(ICAO) & ICAO != "")
Define the UI for the "Air Quality Data" app
ui_aq <- fluidPage(
titlePanel("Air Quality Data App"),
sidebarLayout(
sidebarPanel(
selectInput("state", "State Code", choices = unique(aqs_monitors$State Code
)),
selectInput("county", "County Code", choices = NULL),
selectInput("site", "Site Number", choices = NULL),
selectInput("parameter", "Parameter Code", choices = NULL),
sliderInput("start_year", "Start Year", min = 2000, max = 2023, value = 2000),
sliderInput("end_year", "End Year", min = 2000, max = 2023, value = 2023),
actionButton("fetch_data", "Fetch Data")
),
mainPanel(
DTOutput("table")
)
)
)
Define the server logic for the "Air Quality Data" app
server_aq <- function(input, output, session) {
observe({
state_filter <- input$state
county_choices <- unique(aqs_monitors[aqs_monitors$State Code
== state_filter, "County Code"])
updateSelectInput(session, "county", choices = county_choices)
})
observe({
state_filter <- input$state
county_filter <- input$county
site_choices <- unique(aqs_monitors[aqs_monitors$State Code
== state_filter &
aqs_monitors$County Code
== county_filter, "Site Number"])
updateSelectInput(session, "site", choices = site_choices)
})
observe({
state_filter <- input$state
county_filter <- input$county
site_filter <- input$site
filtered_data <- aqs_monitors %>%
filter(`State Code` == state_filter,
`County Code` == county_filter,
`Site Number` == site_filter)
unique_parameters <- unique(filtered_data$`Parameter Code`)
updateSelectInput(session, "parameter", choices = unique_parameters)
})
data_retrieval <- eventReactive(input$fetch_data, {
myuser <- create_user(email = "", key = "*")
state_filter <- input$state
county_filter <- sprintf("%03d", as.numeric(input$county))
site_filter <- sprintf("%04d", as.numeric(input$site))
parameter_filter <- input$parameter
start_year <- input$start_year
end_year <- input$end_year
data_list <- list()
for (year in start_year:end_year) {
bdate <- paste0(year, "0101")
edate <- paste0(year, "1231")
AQData <- aqs_dailyData(aqs_user = myuser,
endpoint = "bySite",
state = state_filter,
county = county_filter,
site = site_filter,
bdate = bdate,
edate = edate,
param = parameter_filter)
if (parameter_filter == "44201") {
AQData <- subset(AQData, pollutant_standard == "Ozone 8-hour 2015")
} else if (parameter_filter == "88101") {
AQData <- subset(
AQData,
sample_duration == "24-HR BLK AVG" &
pollutant_standard == "PM25 Annual 2012" &
method %in% c("Teledyne T640 at 5.0 LPM - Broadband spectroscopy")
)
}
data_list[[as.character(year)]] <- AQData
}
combined_data <- do.call(rbind, data_list)
return(combined_data)
})
output$table <- renderDT({
filtered_data <- data_retrieval()
filtered_data$first_max_value <- format(filtered_data$first_max_value, nsmall = 3)
datatable(filtered_data, options = list(pageLength = 10))
})
}
Create the Shiny app for "Air Quality Data"
aq_app <- shinyApp(ui_aq, server_aq)
Run the app
shinyApp(ui = aq_app, server = function(input, output, session) {})