Hi Experts,
I'm a newbee in R coding. I want to compile data from multiple CSVs and based on the repeated object in a column, I want to make a new dataframe, from where I can add a new column and the last repeated Objects' value (from another column), is treated as the new value for the newly created column, which is to be added against the Object, in dataframe. Below is the sample data
CSV 1:
Date | Action | Alm id | Occur_time |
---|---|---|---|
01-06-2020 | Insert | 123457 | 6/1/2020 11:30:45 |
01-06-2020 | Altered | 123457 | 6/1/2020 11:35:45 |
01-06-2020 | Altered | 123457 | 6/1/2020 11:36:40 |
01-06-2020 | Altered | 123457 | 6/1/2020 11:35:40 |
01-06-2020 | Altered | 123457 | 6/1/2020 11:37:45 |
01-06-2020 | Cleared | 123457 | 6/1/2020 11:45:45 |
02-06-2020 | Insert | 123455 | 6/2/2020 00:15:25 |
02-06-2020 | Altered | 123455 | 6/2/2020 00:15:25 |
02-06-2020 | Altered | 123455 | 6/2/2020 00:25:15 |
02-06-2020 | Altered | 123455 | 6/2/2020 00:26:05 |
CSV 2:
Date | Action | Alm id | Occur_time |
---|---|---|---|
03-06-2020 | Cleared | 123455 | 6/3/2020 00:15:25 |
03-06-2020 | Insert | 123425 | 6/3/2020 14:15:25 |
03-06-2020 | Cleared | 123425 | 6/3/2020 16:15:25 |
03-06-2020 | Altered | 123425 | 6/3/2020 14:45:25 |
03-06-2020 | Altered | 123425 | 6/3/2020 14:12:25 |
03-06-2020 | Insert | 112625 | 6/3/2020 15:12:25 |
03-06-2020 | Altered | 112625 | 6/3/2020 16:12:25 |
03-06-2020 | Altered | 112625 | 6/3/2020 17:12:25 |
Output Needed:
Date Alm id First_Occur_time Last_Occur_time Cleared_Time
01-06-2020 123457 6/1/2020 11:30:45 6/1/2020 11:37:45 6/1/2020 11:45:45
02-06-2020 123455 6/2/2020 00:15:25 6/2/2020 00:26:05 6/3/2020 00:15:25
03-06-2020 123425 6/3/2020 14:15:25 6/3/2020 14:45:25 6/3/2020 16:15:25
03-06-2020 112625 6/3/2020 15:12:25 6/3/2020 17:12:25
Important Aspect : Alm id and Occur_time needs to be sorted initially, after combining the data from CSVs in a dataframe and then the output needs to be derived.
Kindly requesting you to provide me an R Code, which can give the above output , as I have 120 CSVs of data to be combined and record count is more than a crore.