我正在尝试在 shinyapp.io 上运行我闪亮的应用程序。
https://mrmoleje.shinyapps.io/north-america-massacres/
该应用程序在 R Studio 中运行良好,但是在服务器中,我的传单地图中的“弹出窗口”完全消失了。shiny.io 日志中没有任何内容可以帮助我,而且我在网上找不到任何指导。以下是该应用程序的代码:
d <- data.frame(massacre_name = c("name1", "name2"),
date = c(1345, 6754),
native_casualties=c(0, 0),
Tribe_name=c("named", "named"),
latitude=c(30.2, 32.4),
longitude=c(-84, -87.1),
web=c("www.address.com", "www.address2.com")
)
#load libraries----
library(readxl)
library(leaflet)
library(dplyr)
library(htmltools)
library(shiny)
library(shinythemes)
#create the UI
ui <- {fluidPage(theme = shinytheme("slate"), titlePanel("Massacres in
North America involving
First Nations Peoples: 1500-1700"),
sidebarLayout(position = "right",
sidebarPanel(
selectInput(inputId = "input1", label = "Tribe name" ,choices =
unique(d$Tribe_name))
),
mainPanel(
leafletOutput("mymap"))
)
)}
server <- function(input, output) {
react <- reactive({
req(input$input1)
df <- d[d$Tribe_name == input$input1,]
df
})
output$mymap <- renderLeaflet({ req(input$input1)
leaflet(data = react()) %>% addTiles() %>% setView(lng = -100.94, lat = 38.94 , zoom = 3.5) %>%
addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
addMarkers(lng = ~longitude, lat= ~latitude,
popup = paste(react()$massacre_name, "<br>", "Date:",
react()$date,
"<br>", "Number of native casualties:",
react()$native_casualties,
"<b><a href"= react()$web))
})
}
shinyApp(ui, server)
关于为什么弹出窗口不出现在服务器版本中的任何想法?