FlexDasboard中的传单不会呈现图表

时间:2016-12-20 22:53:11

标签: r shiny leaflet rstudio flexdashboard

我正在创建一个flexdashboard并在其中包含一个传单地图。

当仪表板呈现时没有显示任何内容时,我将地图添加到markdown文件,并且我在R Markdown控制台中收到以下警告:

  

normalizePath中的警告(path.expand(path),winslash,mustWork):     path [1] =" figure-html / chart_categories-1.mb.png":系统找不到指定的路径

     

normalizePath中的警告(path.expand(path),winslash,mustWork):     path [1] =" figure-html / chart_categories-1.png":系统找不到指定的路径

现在,错误很奇怪,好像我独立于它呈现的仪表板运行它而没有问题,当我创建一个新的仪表板并且传单映射是唯一的块但是我的其余部分时,它也会呈现没有问题代码导致问题。

另外,如果我在没有评估地图块的情况下运行仪表板,它就能完美运行。

任何可能导致此问题的想法?

我的传单代码如下:

countries <- readOGR("/filepath")



country_map = sqlQuery(pa,"SELECT *
  FROM [PortAnalyzer].[dbo].[Country] c
  join BarraCountryRegion b on right(b.Factor,3) = c.CountryCode
  where b.Model = 'GEM3L' and LEN(b.Factor)=9 ",stringsAsFactors = FALSE)


countries@data = countries@data %>% left_join(country_map,c('ISO_A3' = 'CountryCode'))

country_attribution = data_melt %>% filter(Category == 'Country' & Style =='Total' & variable == 'Total' & 
                                                   !`Sub-Category` %in% c('Total','CASH'))




countries@data = countries@data %>% left_join(country_attribution,c('Factor' = 'Sub-Category'))


map <- leaflet(countries)

# Create a continuous palette function
pal <- colorNumeric(
        palette = "Blues",
        domain = countries$value
)

binpal = colorNumeric('RdYlGn',countries$value)

test = countries@data

# Apply the function to provide RGB colors to addPolygons
map %>%
        addPolygons(stroke = FALSE, smoothFactor = 0.2, fillOpacity = 1,color = binpal(countries$value)
        ) %>%
        addLegend("bottomright", pal = binpal, values = countries$value,
    title = "Total Return",
    labFormat = labelFormat(suffix = "%"),
    opacity = 1
  )

1 个答案:

答案 0 :(得分:2)

我能够通过在Shiny功能中输入Leaflet来使其工作:

renderLeaflet({})