0
此地图在过去对我有效,但现在当我在iosslides中运行它时,我得到以下结果(请参阅图像)。我想我已经更新了我所有的软件包,并且地图在控制台中加载得很好。我已经为此幻灯片单独获取了代码 - 它应该全部包含在这里。任何想法发生了什么? result in r markdownR单张地图显示在控制台中但不是降价
```{r fig.width=8, fig.height=4, fig_align="center", echo=FALSE, warning=FALSE, message=FALSE}
library(pacman)
p_load(dplyr, tidyr, readr, tigris, acs, magrittr, foreign, ggplot2, gridExtra, ggthemes, leaflet, maps)
#map
la_trad_school_perf_map_layers <- leaflet(lac_schools) %>%
addProviderTiles("CartoDB.Positron") %>%
setView(-118.4, 34.05, zoom = 9) %>%
addCircleMarkers(
radius = 3,
color = ~pal_measure(Math_Prof_Category_1516),
stroke= FALSE,
fillOpacity = 1,
popup=school_popup,
group="15-16 Math Proficiency Rates"
) %>%
addPolygons(data = income_200k_plus_merged,
fillColor = ~pal_income(plus_200k_pct),
color = "Greens",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
popup = popup_200k,
group="% of Households with Income > $200k - 2015")%>%
addPolygons(data = poverty_merged,
fillColor = ~pal_poverty(poverty_rate),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
#popup = popup_poverty,
group="% of Residents in Poverty - 2015")%>%
addPolygons(data = unemployment_merged,
fillColor = ~pal_unemp(unemp_rate_2064),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
#popup = popup_poverty,
group="% of Unemployed Adults - 2015")%>%
addPolygons(data = commute_merged,
fillColor = ~pal_commute(commute_perc_60_more),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
#popup = popup_poverty,
group="% of Adults with a Commute > 60 min.")%>%
addPolygons(data = ed_attain_merged,
fillColor = ~pal_ed_attain(lt_hs_degree_rate_18_44),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
#popup = popup_ed_attain,
group="% of Adults Without a HS Degree - 2015")%>%
addPolygons(data = cit_merged,
fillColor = ~pal_cit(non_citizenship_rate),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
popup = popup_cit,
group="Non-U.S. Citizen - 2015")%>%
addPolygons(data = grandchildren_merged,
fillColor = ~pal_grandchildren(living_with_grand_rate),
color = "#b2aeae",
fillOpacity = 0.5,
weight = 1,
smoothFactor = 0.2,
popup = popup_grandchildren,
group="% of Children Raised by Grandparents - 2015")%>%
#addMarkers(data=la_homicides_assaults,
# la_homicides_assaults$lat,
# la_homicides_assaults$lng,
# group="Incidents of Violent Crime - 2015") %>%
addLayersControl(
baseGroups=c("% of Households with Income > $200k - 2015",
"% of Residents in Poverty - 2015",
"% of Unemployed Adults - 2015",
"% of Adults with a Commute > 60 min.",
"% of Adults Without a HS Degree - 2015",
"% of Non U.S. Citizens - 2015",
"% of Children Raised by Grandparents - 2015"),
overlayGroups=c("15-16 Math Proficiency Rates"),
options = layersControlOptions(collapsed = TRUE))
la_trad_school_perf_map_layers
```