0

不确定在没有可重复的示例数据的情况下你们是否都能帮助我,但我在运行下面的代码时遇到了问题。我正在尝试使用 multidplyr 包,但它似乎找不到我的专栏。我正在运行以下代码:

cl <- detectCores()
cl

models_prep <-
  bookings_prep %>%
  inner_join(pipeline_prep_, by = c("booking_type", "group")) %>%
  crossing(biz_day) %>%
  left_join(closed_pipeline, by = c("booking_type", "group")) %>%
  select(-opportunity_forecast_category)

group1 <- rep(1:cl, length.out = nrow(models_prep))
models_prep1 <- bind_cols(tibble(group1), models_prep)


cluster <- new_cluster(cl)

cluster %>%
  cluster_library("tidyr") 

cluster %>%
  cluster_library("purrr") 

cluster %>%
  cluster_library("plyr") 

cluster %>%
  cluster_library("dplyr") 

cluster_copy(cluster, "rmf")
cluster_copy(cluster, "fc_xreg")


#cluster_assign(cluster, "rmf")
#cluster_copy(cluster,c("rmf","fc_xreg"))

by_group <- models_prep %>%
  group_by(group) %>%
  partition(cluster) 

by_group1 <- models_prep1 %>%
  group_by(group1) %>%
  partition(cluster) 

models <-  by_group %>%
  mutate(
    xreg_arima = pmap(list(data = pipeline, h = 1,name = group, bookings = bookings, type = booking_type,
                           biz_day = biz_day, no_bookings = no_bookings,
                           sparse_pipeline = sparse_pipeline,
                           closed_forecast_cat = pipeline_amount, FUN = "fc_xreg"), rmf))

一切都运行到模型 <- 正确,但它在那里失败,说它找不到对象组。这是 by_group 数据框的样子。

在此处输入图像描述

4

1 回答 1

0

有时只需要引用参数,特别是在 dplyr-ish 情况下。

models <-  by_group %>%
  mutate(
    xreg_arima = pmap(list(data = pipeline, h = 1,name = "group", bookings = "bookings", type = "booking_type",
                           biz_day = "biz_day", no_bookings = "no_bookings",
                           sparse_pipeline = "sparse_pipeline",
                           closed_forecast_cat = "pipeline_amount", FUN = "fc_xreg"), rmf))
于 2020-10-22T04:50:52.123 回答