Reputation: 1111
library(reshape2)
dcast(new, Subscriber_code ~ series, fun.aggregate = sum, value.var = "Views_Total")
There are around 340 series and its taking forever to generate a wide format data. I have around 1 million subscriber_codes
. Is there a way around this problem?
Upvotes: 0
Views: 60
Reputation: 887153
We can use dcast
from library(data.table)
. It should be fast compared to the current option.
library(data.table)
dcast(setDT(new), Subscriber_code ~ series, fun.aggregate = sum,
value.var = "Views_Total")
Upvotes: 2