Hi everyone,
I have a dataset that has 3 columns:
Date - Date of the event
Car - the number of the car
Client - The person who is riding in the car
If on a given date, a car has more than one client, they have two rows. I would like to make the data wide so I can get the average per car over a period of time.
The data that I have is this:
Date | Car | Client |
01/01/18 | 1 | Ente |
01/02/18 | 1 | Patterson |
01/02/18 | 1 | Jeter |
01/02/18 | 2 | Davidson |
01/03/18 | 1 | Steve |
01/03/18 | 1 | Gonzalez |
01/03/18 | 2 | York |
01/03/18 | 2 | Camara |
01/03/18 | 2 | Camara |
01/04/18 | 1 | Waters |
01/04/18 | 1 | Ventre |
01/04/18 | 2 | Perez |
01/04/18 | 3 | Rodriguez |
01/04/18 | 3 | Jeter |
01/04/18 | 3 | Jiminez |
The data that I would like is this:
Date | CAR1_Count | Car2_Count | Car3_Count | TotalCount |
1/1/2018 | 1 | 0 | 0 | 1 |
1/2/2018 | 2 | 1 | 0 | 3 |
1/3/2018 | 2 | 3 | 0 | 5 |
1/4/2018 | 2 | 1 | 3 | 6 |
Any suggestions would be greatly appreciated.
Thank you!