What I am trying to do is to get a list of stores then multiply those list of stores by a column called x-factor which will be the maximum for similar stores.
the list will come directly from a column called outlets.
Factors.out <- Metros[,list(n=NROW(Metros$outlet), XF=max(Metros$x_factor),
by=c("CategoryMnemonic","pno","metro_spaza"))]
Factors.out$Sum_XF <- Factors.out$n*Factors.out$XF
this is the error I get:
Error: Unsupported index type: list
so for store 000300 for instance then the code will aggregate the number of stores * maximum x_factor, then merge by the columns in the by clause.