Как добавить файл css в R Shiny, чтобы улучшить мое приложение? - PullRequest
0 голосов
/ 13 июля 2020

Я попытался создать Shiny R. Я преуспел с элементом переполнения стека. Тем не менее, было предложено добавить больше вопросов как самостоятельно. У меня есть несколько проблем с моим приложением:

  1. Как видите, моя карта не занимает весь экран. Возможно ли это получить? Как? (Я обновил вопрос этим дополнительным баллом)

Вот чего мне удалось добиться:

library(shiny)
library(tidyverse)
library(leaflet)

fake_data <- read.csv("https://raw.githubusercontent.com/gabrielburcea/stackoverflow_fake_data/master/gather_divided.csv")

# Define UI for application that draws a histogram
ui <- fluidPage(
    
    # Application title
    h1("Symptoms accross the world"),
    
    # Sidebar with a slider input for number of bins 
    leafletOutput("map"), 
    
    #Floating panel 
    absolutePanel(id = "controls", class = "panel panel-default", fixed = TRUE,
                  draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
                  width = 330, height = "auto",
                  
                  shiny::selectInput("symptom", "Select Symptom", c("Chills",
                                                                    "Cough",
                                                                    "Diarrhoea",
                                                                    "Fatigue",
                                                                    "Headache",
                                                                    "Loss of smell and taste",
                                                                    "Muscle ache",
                                                                    "Nasal congestion",
                                                                    "Nausea and vomiting",
                                                                    "Shortness of breath",
                                                                    "Sore throat",
                                                                    "Sputum",
                                                                    "Temperature"), multiple = TRUE)
                  
    )
    
)

server <- function(input, output) {
    
    filtered_data <- reactive({
        fake_data %>% 
            dplyr::filter(Symptom %in% input$symptom)
    })
    
    output$map <- renderLeaflet({
        leaflet() %>%
            addTiles() %>%
            addMarkers(data = filtered_data(), clusterOptions = markerClusterOptions())
        
    })
    
}


# Run the application 
shinyApp(ui = ui, server = server)

1 Ответ

0 голосов
/ 15 июля 2020

Я решил первую проблему с этим кодом:

leafletOutput("map", width = "100%", height = "95vh")
...