问题描述
不确定在没有可重现的示例数据的情况下是否所有人都能为我提供帮助,但是我在运行以下代码时遇到问题。我正在尝试使用multidplyr包,但似乎找不到我的专栏。我正在运行以下代码:
cl <- detectCores()
cl
models_prep <-
bookings_prep %>%
inner_join(pipeline_prep_,by = c("booking_type","group")) %>%
crossing(biz_day) %>%
left_join(closed_pipeline,"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))
一切正常运行到模型
解决方法
有时只需要引用参数,尤其是在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))