我有下表:
> head (data6)
verb_object SESSION_ID transactionID sequenceID eventID items
1: 34D89F927092290A5DA9B108F7020C19 SELECT 36652675 2058 36652675 1 OV1
2: 15873DB37BF80750C70B68A8778B9DC01D548B6D06E3BF92CADAFF289B3FCAEE CALL 38763251 90 38763251 1 OV2
3: D6941F85A1763F1F2D27B8F032D6411C86D4A5200512D65F381052C7D42BF57F CALL 40257471 63 40257471 1 OV3
4: E768D36C813FD14157B06474F345EAFC SELECT 40897086 39475 40897086 1 OV4
5: 15873DB37BF80750C70B68A8778B9DC01D548B6D06E3BF92CADAFF289B3FCAEE CALL 40907760 57 40907760 1 OV2
6: 8067DE5FF5089BE6EC9D213F42525FC3 SELECT 40928334 29697 40928334 1 OV5
我想提取一个数据框,对于每个唯一的(verb_object),相应的项值将表示如下:
> U1
verb_object items
34D89F927092290A5DA9B108F7020C19 SELECT OV1
15873DB37BF80750C70B68A8778B9DC01D548B6D06E3BF92CADAFF289B3FCAEE CALL OV2
D6941F85A1763F1F2D27B8F032D6411C86D4A5200512D65F381052C7D42BF57F CALL OV3
E768D36C813FD14157B06474F345EAFC SELECT OV4
8067DE5FF5089BE6EC9D213F42525FC3 SELECT OV5
答案 0 :(得分:3)
你可以这样做(似乎你有一个data.table
作为输入,我注意到它dt
):
unique(dt[,c("verb_object", "items"), with=F])