我正在使用dplyr进行一些数据处理,而这些处理都是使用我的巨大数据(b
)框架。
我已经能够成功处理较小的数据子集。我想我的问题出在我数据框的大小上。
我有一个具有400万行和34列的数据框。
我的代码如下:
df<-b %>%
group_by(Id) %>%
mutate(numberoflead = n(),#lead sayısı
lastcreateddateoflead=max(CreatedDate),#last date of lead
firstcreateddateoflead=min(CreatedDate),#first date of lead
lastcloseddate=max(Kapanma.tarihi....),#last closed date of kapanm tarihi
yas=as.Date(lastcloseddate)-as.Date(firstcreateddateoflead),#yas
leadduration=as.Date(lastcreateddateoflead)-as.Date(firstcreateddateoflead)) %>%#lead duration
inner_join(b %>%
select(Id, CreatedDate, lasttouch = Lead_DataSource__c),
by = c("Id" = "Id", "lastcreateddateoflead" = "CreatedDate")) %>% #lasttouch
inner_join(b %>%
select(Id, CreatedDate, firsttouch = Lead_DataSource__c),
by = c("Id" = "Id", "firstcreateddateoflead" = "CreatedDate")) %>% #firsttouch
inner_join(b %>%
select(Id, Kapanma.tarihi...., laststagestatus = StageName),#laststagestatus
by = c("Id" = "Id", "lastcloseddate" = "Kapanma.tarihi...."))
它在我的数据框的较小子集上运行良好,但是,当我在完整的数据框上运行以上代码时, 它运行了很长时间,最终崩溃了。我认为问题可能出在我数据框的400万行上
有人对此有任何建议吗?非常感谢您的帮助!