闪亮的承诺不能与传单情节一起使用

问题描述

我正在尝试使用Future and promises软件包来加快我的传单制作。我参考了 Promises package article by shiny

但是我遇到了错误。即“在使用它时不知道如何将类传单的对象转换为Promise”

library(shiny)
library(leaflet)
library(promise)
library(future)
plan(multiprocess)
library(tidyverse)

 ui <- navbarPage(
     tabPanel(
          "Map",sidebarLayout(
               sidebarPanel(
                    br(),mainPanel(
                     leafletoutput("plot_map")
))))

#Loading Germany map using future
shp1 <- future({geojson_read('www/bundeslander.geojson',what="sp")})
geo_lookup <- read.csv('www/country_codes.csv',stringsAsFactors=F)

server <- function(input,output,session)
{
  facebook_filtered <- reactive({
    data_fb %>%
      collect() %>%
      mutate_if(is.integer64,as.integer) %>%
      left_join(geo_lookup,by=c("country_name"="Code"))
    
  })
  map_data <- reactive({
        fbf <- facebook_filtered()

 shp1@data %...>%
          mutate_if(is.factor,as.character) %...>%
          left_join(fbf %...>%
                      mutate(region=as.character(region)) %...>%
                      group_by(region) %...>%
                      summarise(impressions_total = sum(impressions,na.rm=T)) %...>%
                      # and then we use these column names to select which data we want to map in the
                      # utility function
                      rename("impressions"=impressions_total) %...>% rename('video_views'=video_views_total),by=c("name"="region")) %...>%
          replace(is.na(.),0)

})

build_leaflet_map <- function(shape_data) {

    leaflet(data= shp1) %...>%
      addProviderTiles(providers$CartoDB.Positron) %...>%
      addpolygons(
        stroke=T,color="#c2c5cc",weight=1,opacity=1,fillOpacity=1,fillColor =  if(sum(shape_data[[data_column]]) > 0) { ~ pal(shape_data[[data_column]]) } else { "#ffffff" },highlight = highlightOptions(
          weight = 2,color = "#989898",fillOpacity = 0.9,bringToFront = T
        ),label = sprintf( ## Todo - Tidy this up
          paste0(
            "<strong>%s</strong><br/>%s ",gsub('_',' ',i18n()$t(data_column))
          ),str_to_title(shape_data$name),## Todo - Set locale to DE where client language is German
          num_format(shape_data[[data_column]])
        ) %...>% lapply(HTML),labelOptions = labelOptions(
          style = list("font-weight" = "normal",padding = "5px 10px"),textsize = "15px",direction = "auto"
        )
      )

    
  }
  #=========================
  
  output$plot_map <- renderLeaflet({
    build_leaflet_map(map_data())
  })



}

# Return a Shiny app object
shinyApp(ui = ui,server = server,options = list(port = 4600,host = '0.0.0.0'))
 

我还没有看到将传单承诺

结合使用的任何来源

任何人都可以解决的问题真的很有帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)