Hello,
Thank you for the response! I haven't had an issue plotting the data itself. RStudio will read the geopackage files using filename <- st_read ("filename.gpkg") and I can plot them using the renderPlot function without a problem. I would just like to be able to edit the color set in order to make the differences in scale more distinguishable. Here's my app code below. Hopefully that's a little more clear- please let me know if you need more detail. Thank you again!
World <-st_read("Tot_World_Cases.gpkg")
US <-st_read("Tot_US_Cases.gpkg")
worlddata <- read.csv("worlddata.csv")
str(worlddata)
mat1 <- as.matrix(worlddata)
str(mat1)
usdata <-read.csv("usdata.csv")
str(usdata)
mat2 <- as.matrix(usdata)
str(mat2)
ui <- fluidPage(
titlePanel(tags$b("Call Data 2014-2018")),
tags$br(),
mainPanel(
tabsetPanel(type = "tabs",
tabPanel ("Maps",
plotOutput("dataset", width = "700px", height = "600px"),
tags$br(),
sidebarPanel(
radioButtons('dataset','Choose a dataset:',choices = c ("US", "World")), helpText("Scale indicates call volume; white areas indicate no data"))),
tabPanel("US Data",
selectizeInput('stateID', tags$h4 (tags$b('Please select a state:')), choices = c("Choose" = "", levels(usdata$State.Name))),
tableOutput("table1")),
tabPanel ("World Data",
selectizeInput('countryID', tags$h4 (tags$b('Please select a country:')), choices = c("Choose" = "", levels (worlddata$Country.Name))),
tableOutput("table2")),
tabPanel("Category Descriptions",
tags$div (class = "header", checked =NA,
tags$h3 (tags$b ("Category Descriptions:")),
tags$br(),
tags$h4("Category Heading", style="color:blue"),
tags$ul(
list(
tags$li ("Category Description")))
)))))
server <- function(input, output, session) {
datasetInput <- reactive ({
switch(input$dataset,
"US"= US,
"World"= World)
})
tab1 <- reactive ({
usdata %>%
filter(State.Name == input$stateID)
})
tab2 <- reactive ({
worlddata %>%
filter(Country.Name == input$countryID)
})
output$dataset <- renderPlot({
plot(datasetInput()['Grand.Total'], main= "Cases by Volume")
})
output$table1 <- renderTable ({t(tab1() [1:1,3:10])}, bordered = TRUE, spacing = "s", width = "auto", rownames = TRUE, colnames = FALSE, na= "N/A")
output$table2 <- renderTable ({ t(tab2 () [1:1,3:10])}, bordered = TRUE, spacing = "s", width = "auto", rownames = TRUE, colnames = FALSE, na= "N/A")
}
shinyApp(ui = ui, server = server)