Aggregate adjacent rows, ignoring certain columns
问题 I have a df like below > head(df) OrderId Timestamp ErrorCode 1 3000000 1455594300434609920 NA 2 3000001 1455594300434614272 NA 3 3000000 1455594300440175104 0 4 3000001 1455594300440179712 0 5 3000002 1455594303468741120 NA 6 3000002 1455594303469326848 0 I need to collapse row in a way that output is something like below > head(df) OrderId Timestamp1 Timestamp2 ErrorCode Diff 3000000 1455594300434609920 1455594300440175104 0 3000001 1455594300434614272 1455594300440179712 0 3000002