如何将 css 文件添加到 R Shiny 以改进我的应用程序?
How to add a css file to R Shiny to improve my app?
我尝试构建一个闪亮的 R。我已经成功地处理了堆栈溢出成员。然而,被鼓励自己添加更多问题。我的应用有几个问题:
- 如您所见,我的地图并没有占据整个屏幕。有可能得到吗?如何? (我已经用这个附加点更新了问题)
这是我设法实现的:
library(shiny)
library(tidyverse)
library(leaflet)
fake_data <- read.csv("https://raw.githubusercontent.com/gabrielburcea/Whosebug_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)
我已经用这段代码解决了第一个问题:
leafletOutput("map", width = "100%", height = "95vh")
我尝试构建一个闪亮的 R。我已经成功地处理了堆栈溢出成员。然而,被鼓励自己添加更多问题。我的应用有几个问题:
- 如您所见,我的地图并没有占据整个屏幕。有可能得到吗?如何? (我已经用这个附加点更新了问题)
这是我设法实现的:
library(shiny)
library(tidyverse)
library(leaflet)
fake_data <- read.csv("https://raw.githubusercontent.com/gabrielburcea/Whosebug_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)
我已经用这段代码解决了第一个问题:
leafletOutput("map", width = "100%", height = "95vh")