Aggregate Categorical Data

I have a scenario in which I'm required to run my analysis at the Account level. One of the features that I'd like to look at is the no. of subscriptions against an account. There can be multiple subscriptions against one account. I wonder how I can "aggregate" these multiple subscriptions and roll them up at the Account level, such that I have a single row for each account.

I could think of binary encoding but I have 5000 products and that would require creating these many features.

• What tool or software or language are you using? Aggregating the number of subscriptions is done using some sort of groupby feature. As for the rest, what do mean by model and what are you using to construct your model? – fswings Sep 22 '19 at 14:50
• In R, the function aggregate will do this. – G5W Sep 22 '19 at 16:42
• I think what I'm asking is that if there are multiple products against an account(after group by and everything) in my analytical dataset, is there a way I could aggregate them in a single row. So that in my final dataset I have one row per account, but only this time with all product information. As I said, one way could be to create as many variables and mark them 1 if that product is included and 0 otherwise. But, I have huge number of features, so it seems not feasible. – Ahsan Sep 22 '19 at 16:43