pranav
pranav

Reputation: 1111

Using dcast on my data frame is taking so much time to generate a wide format data?

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

Answers (1)

akrun
akrun

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

Related Questions