I’m a R beginner and having difficulty with the following pretty simple problem;
I have the following transaction data:
Data
Row#ID Lable Date Time
4 15275 John 2000-05-16 16:15:00
7 15275 John 2000-05-16 16:25:00
22 15276 Bob 2000-07-04 18:05:00
25 15276 Bob 2000-08-07 05:23:00
10 1234 Kate 2000-06-17 18:07:00
13 1234 Kate 2000-06-21 06:49:00
And need to generate a unique entry for each ID with the minimum Date and minimum Time,
Similar to this:
Row# ID Lable Date Time
15275 John 2000-05-16 16:15:00
15276 Bob 2000-07-04 18:05:00
1234 Kate 2000-06-17 18:07:00
I have tried
unique<-aggregate(Date$Date ,list(Data$ID, Data$Time,unique_Data$Lable ), min)
to no avail.
Any assistance would be greatly appreciated.
Thanks
If the Data and Time columns are of class “character” or any other class for which there is a
minmethod (but in particular not if either one is of class “factor) you could use this:Noting that there was a need to cover the class==”factor’ issue, this would have covered even that possibility;