I'm using the data.table
package to speed up some summary statistic collection on a data set.
I'm curious if there's a way to group by more than one column. My data looks like this:
purchaseAmt adShown url
15.54 00001 150000001
4.82 00002 150000001
157.99 05005 776300044
... ... ...
I can do something like this:
adShownMedian <- df1[,median(purchaseAmt),by="adShown"]
to get each ad's median. How would I do something that combines adShown
and url
?
I've tried this:
adShownMedian <- df1[,median(purchaseAmt),by=c("adShown","url")]
but no luck.
Any suggestions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…