SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
Aggregating at Different Levels [ Reply ]
By: Kagiso Boikanyo on 2018-03-15 11:15
[forum:45757]

data.xlsx (71) downloads
Good day not sure what I am doing wrong in this instance but all I want to do is aggregate the estval and estvol in the file I just uploaded in R at certain levels and it keeps throwing out this error:
Error in `[.tbl_df`(data, , .(estval = sum(estval), estvol = sum(estvol)), :
unused argument (by = c("period"))

the file has been attached so I hope you'll be able to direct me towards the mistake I'm making at this moment, here is the code below:

sum_module <- data[,
.(estval=sum(estval),estvol=sum(estvol)),
by=c("period","region" , "channel" , "cell" , "basket" , "module")]

sum_brn <- data[,
.(estval=sum(estval),estvol=sum(estvol)),
by=c("period", "region" , "channel" , "cell" , "basket" , "module" , "manufacturer" , "brand")]


Thanks to:
Vienna University of Economics and Business Powered By FusionForge