I have a table with in game user purchases, the columns are:
uid levelid created timeid price
I want by using the reshape's cast function extract for each unique player the minimum values of "timeid"s (timeid - is the time of purchase in unixformat) plus I want the minimum values of "levelid"s (levelid - is the players level on which the purchase has been made) and the last thing - I want to add the "created" value to the table (created - is the time when the user installed the game)
To do the cast with one value is quite simple, I use such a code
pivot<-cast(sbw0214, uid + created ~ ., min, value='timeid')
but what should I write if I want to add the levelid?
The
pivot<-cast(sbw0214, uid + created ~ ., min, value=c('levelid', 'timeid'))
is not working.
UPD: as asked below, added some dummy data
uid levelid created timeid price
1 859053 12 1392080130 1392703139 6.99
2 5878556 16 1392092198 1392305961 66.00
4 5878556 18 1392092198 1392541437 649.00
8 5878556 14 1392092198 1392092388 229.00
12 6580096 11 1391707958 1392149148 66.00
13 6582371 10 1392400831 1392584819 2.49
14 6582371 12 1392400831 1392752459 4.99
15 6993255 14 1392318992 1392569031 13.99
16 6993255 9 1392318992 1392391040 1.49
22 7437087 8 1392734333 1392832027 1.99
23 7437087 8 1392734333 1392859236 3.99
24 7437087 8 1392734333 1392832005 1.99
25 7484797 17 1391578980 1391626414 19.99