【问题标题】:Error in is.data.frame(.l) : object 'group' not foundis.data.frame(.l) 中的错误:找不到对象“组”
【发布时间】:2020-10-22 02:59:19
【问题描述】:

不确定在没有可重现的示例数据的情况下你们是否能够帮助我,但我在运行下面的代码时遇到了问题。我正在尝试使用 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))

一切都运行到模型

【问题讨论】:

    标签: r parallel-processing tidyverse multidplyr


    【解决方案1】:

    有时只需要引用参数,尤其是在 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))
    

    【讨论】:

    • 我相信这行得通,但现在我得到了错误:UseMethod(“select_”)中的错误:没有适用于“select_”的方法应用于“字符”类的对象我知道什么这表明,但我知道为什么它会开始处理而看不到 df 或 tibble?
    • 抱歉,我仔细看了看,结果不太好。它只是将这些字符串作为输入,而不是引用具有该名称的实际变量
    猜你喜欢
    • 2018-02-25
    • 1970-01-01
    • 2015-10-22
    • 2020-08-17
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 2012-11-20
    • 2017-09-28
    相关资源
    最近更新 更多