各种错误传单上传到RPubs

时间:2019-04-18 19:43:05

标签: r r-markdown

我一直在努力使它工作数小时,却无法使其工作。

我实际上是从大量的excel表格创建数据框架,然后创建交互式的传单地图来显示数据。

问题出在地图上,我可以编织/运行所有数据,并且可以很好地显示到查看器窗口中,但是当我尝试上传到Rpubs时,会遇到各种错误。

通常是错误18

  

卷曲:(18)传输关闭,剩余未完成的读取数据   http(协议,“ api.rpubs.com”,端口,方法,路径,标题,     卷曲请求失败(发生卷曲错误18)   通话:-> http

我已经多次卸载并重新安装了R和R Studio

已卸载并重新安装了所有软件包。我将地图的数量减少到只有1个,但有图层,但是它不起作用...

我真的不知道如何显示少量代码来做到这一点,但这是我的传单代码。

# Create the popup dialog for both layers

final_district_dataframe_popups_sfsp <- paste0(
  "District Name: ", final_district_dataframe$sfa_name, "<br>",
  "Free and Reduced Percent: ", round(final_district_dataframe$free_and_red_perc, digits = 3), "<br>",
  "SFSP Site Count: ", final_district_dataframe$site_count_sfsp, "<br>",
  "SFSP Average ADP: ", final_district_dataframe$adp_sfsp_2018)

final_district_dataframe_popups_score <- paste0(
  "District Name: ", final_district_dataframe$sfa_name, "<br>",
  "Free and Reduced Percent: ", round(final_district_dataframe$free_and_red_perc, digits = 3), "<br>",
  "Score: ", round(final_district_dataframe$score, digits = 3), "<br>", 
  "School Breakfast Program: ", final_district_dataframe$sbp, "<br>",
  "National School Lunch Program: ", final_district_dataframe$nslp, "<br>",
  "Afterschool Snack Program: ", final_district_dataframe$snack, "<br>",
  "Special Milk Program: ", final_district_dataframe$smp)

# Create the color pallet for each layer

sfsp_pal <- colorNumeric(palette = "plasma", 
                                domain = 
score_pal <- colorNumeric(palette = "plasma", 
                                domain = final_district_dataframe$score)

# create the map

layer_map <- final_district_dataframe %>% 
  st_transform(crs = "+init=epsg:4326") %>% 
  leaflet(width = "100%" ,options = leafletOptions(minZoom = 6)) %>% 
  addProviderTiles("Esri.WorldGrayCanvas") %>% 
  setView(lng = -106, lat = 39.6, zoom = 6.5) %>% 
    addPolygons(popup = final_district_dataframe_popups_score,
              group = "Score",
              stroke = FALSE,
              smoothFactor = 0,
              fillOpacity = 0.6,
              color = ~ score_pal(score),
              highlightOptions = highlightOptions(color = "white", weight = 2,
                                                  bringToFront = TRUE)) %>%
  addLegend("bottomright", 
            group = "Score",
            pal = score_pal, 
            values = ~ score,
            title = "Evaluated Risk Score",
            opacity = 1) %>% 
  addPolygons(popup = final_district_dataframe_popups_sfsp,
              group = "SFSP",
              stroke = FALSE,
              smoothFactor = 0,
              fillOpacity = 0.6,
              color = ~ sfsp_pal(adp_sfsp_2017),
              highlightOptions = highlightOptions(color = "white", weight = 2,
                                                  bringToFront = TRUE)) %>%
  addLegend("bottomright", 
            group = "SFSP",
            pal = sfsp_pal, 
            values = ~ adp_sfsp_2017,
            title = "adp_sfsp_2017",
            opacity = 1) %>% 
  addLayersControl(
    baseGroups = c("Score", "SFSP"),
    options = layersControlOptions(collapsed = FALSE, position = "topleft")) %>% 
  hideGroup("SFSP")

layer_map

我正在尝试发布到html。类似于以下内容,但仍会出现错误:

创建地图之前的代码的较早部分

http://rpubs.com/cherritt/488395

0 个答案:

没有答案