There are 3 CSVs in this dataset. Accidents is the primary one. The raw compiled 2005 to 2015 datasets downloaded from kaggle are as below:
| ï..Accident_Index | Location_Easting_OSGR | Location_Northing_OSGR | Longitude | Latitude | Police_Force | Accident_Severity | Number_of_Vehicles | Number_of_Casualties | Date | Day_of_Week | Time | Local_Authority_.District. | Local_Authority_.Highway. | X1st_Road_Class | X1st_Road_Number | Road_Type | Speed_limit | Junction_Detail | Junction_Control | X2nd_Road_Class | X2nd_Road_Number | Pedestrian_Crossing.Human_Control | Pedestrian_Crossing.Physical_Facilities | Light_Conditions | Weather_Conditions | Road_Surface_Conditions | Special_Conditions_at_Site | Carriageway_Hazards | Urban_or_Rural_Area | Did_Police_Officer_Attend_Scene_of_Accident | LSOA_of_Accident_Location |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200501BS00001 | 525680 | 178240 | -0.191170 | 51.48910 | 1 | 2 | 1 | 1 | 04/01/2005 | 3 | 17:42 | 12 | E09000020 | 3 | 3218 | 6 | 30 | 0 | -1 | -1 | 0 | 0 | 1 | 1 | 2 | 2 | 0 | 0 | 1 | 1 | E01002849 |
| 200501BS00002 | 524170 | 181650 | -0.211708 | 51.52007 | 1 | 3 | 1 | 1 | 05/01/2005 | 4 | 17:36 | 12 | E09000020 | 4 | 450 | 3 | 30 | 6 | 2 | 5 | 0 | 0 | 5 | 4 | 1 | 1 | 0 | 0 | 1 | 1 | E01002909 |
| 200501BS00003 | 524520 | 182240 | -0.206458 | 51.52530 | 1 | 3 | 2 | 1 | 06/01/2005 | 5 | 00:15 | 12 | E09000020 | 5 | 0 | 6 | 30 | 0 | -1 | -1 | 0 | 0 | 0 | 4 | 1 | 1 | 0 | 0 | 1 | 1 | E01002857 |
| 200501BS00004 | 526900 | 177530 | -0.173862 | 51.48244 | 1 | 3 | 1 | 1 | 07/01/2005 | 6 | 10:35 | 12 | E09000020 | 3 | 3220 | 6 | 30 | 0 | -1 | -1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 | E01002840 |
| No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing |
|---|---|---|---|---|---|
1 |
ï..Accident_Index |
1. 200501BS00001Â 2. 200501BS00002Â 3. 200501BS00003Â 4. 200501BS00004Â 5. 200501BS00005Â 6. 200501BS00006Â 7. 200501BS00007Â 8. 200501BS00009Â 9. 200501BS00010Â 10. 200501BS00011Â [ 1780643 others ] |
1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1780643 (100.0%) |
0Â (0%) |
|
2 |
Location_Easting_OSGR |
Mean (sd) : 440179.9 (95476) |
218883 distinct values |
138 |
|
3 |
Location_Northing_OSGR |
Mean (sd) : 298512.8 (161225.4) |
267801 distinct values |
138 |
|
4 |
Longitude |
Mean (sd) : -1.4 (1.4) |
1246102 distinct values |
138 |
|
5 |
Latitude |
Mean (sd) : 52.6 (1.5) |
1168981 distinct values |
138 |
|
6 |
Police_Force |
Mean (sd) : 30.8 (25.5) |
51 distinct values |
0 |
|
7 |
Accident_Severity |
Mean (sd) : 2.8 (0.4) |
1 : 22998 ( 1.3%) |
0 |
|
8 |
Number_of_Vehicles |
Mean (sd) : 1.8 (0.7) |
28 distinct values |
0 |
|
9 |
Number_of_Casualties |
Mean (sd) : 1.3 (0.8) |
51 distinct values |
0 |
|
10 |
Date |
1. 01/01/2005 |
308 ( 0.0%) |
0 |
|
11 |
Day_of_Week |
Mean (sd) : 4.1 (1.9) |
1 : 195326 (11.0%) |
0 |
|
12 |
Time |
1. |
151 ( 0.0%) |
0 |
|
13 |
Local_Authority_.District. |
Mean (sd) : 353.3 (259.3) |
416 distinct values |
0 |
|
14 |
Local_Authority_.Highway. |
1. E06000001 |
1754 ( 0.1%) |
0 |
|
15 |
X1st_Road_Class |
Mean (sd) : 4.1 (1.4) |
1 : 68634 ( 3.8%) |
0 |
|
16 |
X1st_Road_Number |
Mean (sd) : 1007.9 (1821.2) |
7062 distinct values |
0 |
|
17 |
Road_Type |
Mean (sd) : 5.2 (1.6) |
1 : 119472 ( 6.7%) |
0 |
|
18 |
Speed_limit |
Mean (sd) : 39 (14.2) |
0 : 1 ( 0.0%) |
0 |
|
19 |
Junction_Detail |
Mean (sd) : 2.3 (2.6) |
-1 : 19 ( 0.0%) |
0 |
|
20 |
Junction_Control |
Mean (sd) : 1.8 (2.3) |
-1 : 641392 (36.0%) |
0 |
|
21 |
X2nd_Road_Class |
Mean (sd) : 2.7 (3.2) |
-1 : 732871 (41.2%) |
0 |
|
22 |
X2nd_Road_Number |
Mean (sd) : 378.3 (1297.4) |
7438 distinct values |
0 |
|
23 |
Pedestrian_Crossing.Human_Control |
Mean (sd) : 0 (0.1) |
-1 : 161 ( 0.0%) |
0 |
|
24 |
Pedestrian_Crossing.Physical_Facilities |
Mean (sd) : 0.7 (1.8) |
-1 : 164 ( 0.0%) |
0 |
|
25 |
Light_Conditions |
Mean (sd) : 2 (1.6) |
1 : 1304474 (73.3%) |
0 |
|
26 |
Weather_Conditions |
Mean (sd) : 1.6 (1.6) |
-1 : 161 ( 0.0%) |
0 |
|
27 |
Road_Surface_Conditions |
Mean (sd) : 1.4 (0.6) |
-1 : 2439 ( 0.1%) |
0 |
|
28 |
Special_Conditions_at_Site |
Mean (sd) : 0.1 (0.7) |
-1 : 124 ( 0.0%) |
0 |
|
29 |
Carriageway_Hazards |
Mean (sd) : 0.1 (0.6) |
-1 : 127 ( 0.0%) |
0 |
|
30 |
Urban_or_Rural_Area |
Mean (sd) : 1.4 (0.5) |
1 : 1146421 (64.4%) |
0 |
|
31 |
Did_Police_Officer_Attend_Scene_of_Accident |
Mean (sd) : 1.2 (0.4) |
-1 : 278 ( 0.0%) |
0 |
|
32 |
LSOA_of_Accident_Location |
1. |
129471 ( 7.3%) |
0 |
| ï..Accident_Index | Vehicle_Reference | Vehicle_Type | Towing_and_Articulation | Vehicle_Manoeuvre | Vehicle_Location.Restricted_Lane | Junction_Location | Skidding_and_Overturning | Hit_Object_in_Carriageway | Vehicle_Leaving_Carriageway | Hit_Object_off_Carriageway | X1st_Point_of_Impact | Was_Vehicle_Left_Hand_Drive. | Journey_Purpose_of_Driver | Sex_of_Driver | Age_of_Driver | Age_Band_of_Driver | Engine_Capacity_.CC. | Propulsion_Code | Age_of_Vehicle | Driver_IMD_Decile | Driver_Home_Area_Type |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200501BS00001 | 1 | 9 | 0 | 18 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 15 | 2 | 74 | 10 | -1 | -1 | -1 | 7 | 1 |
| 200501BS00002 | 1 | 11 | 0 | 4 | 0 | 3 | 0 | 0 | 0 | 0 | 4 | 1 | 1 | 1 | 42 | 7 | 8268 | 2 | 3 | -1 | -1 |
| 200501BS00003 | 1 | 11 | 0 | 17 | 0 | 0 | 0 | 4 | 0 | 0 | 4 | 1 | 1 | 1 | 35 | 6 | 8300 | 2 | 5 | 2 | 1 |
| 200501BS00003 | 2 | 9 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 15 | 1 | 62 | 9 | 1762 | 1 | 6 | 1 | 1 |
| No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing |
|---|---|---|---|---|---|
1 |
ï..Accident_Index |
1. -1Â 2. 200501BS00001Â 3. 200501BS00002Â 4. 200501BS00003Â 5. 200501BS00004Â 6. 200501BS00005Â 7. 200501BS00006Â 8. 200501BS00007Â 9. 200501BS00009Â 10. 200501BS00010Â [ 1780644 others ] |
257845 ( 7.3%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 2 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 2 ( 0.0%)Â 2 ( 0.0%)Â 1 ( 0.0%)Â 2 ( 0.0%)Â 3262257 (92.7%) |
0Â (0%) |
|
2 |
Vehicle_Reference |
Mean (sd) : 1.6 (0.8) |
68 distinct values |
257845 |
|
3 |
Vehicle_Type |
Mean (sd) : 9.6 (8.4) |
21 distinct values |
257845 |
|
4 |
Towing_and_Articulation |
Mean (sd) : 0 (0.3) |
-1 : 433 ( 0.0%) |
257845 |
|
5 |
Vehicle_Manoeuvre |
Mean (sd) : 12.7 (6.2) |
19 distinct values |
257845 |
|
6 |
Vehicle_Location.Restricted_Lane |
Mean (sd) : 0.1 (1) |
11 distinct values |
257845 |
|
7 |
Junction_Location |
Mean (sd) : 2.5 (3.2) |
-1 : 9943 ( 0.3%) |
257845 |
|
8 |
Skidding_and_Overturning |
Mean (sd) : 0.2 (0.7) |
-1 : 269 ( 0.0%) |
257845 |
|
9 |
Hit_Object_in_Carriageway |
Mean (sd) : 0.3 (1.6) |
13 distinct values |
257845 |
|
10 |
Vehicle_Leaving_Carriageway |
Mean (sd) : 0.4 (1.4) |
-1 : 251 ( 0.0%) |
257845 |
|
11 |
Hit_Object_off_Carriageway |
Mean (sd) : 0.6 (2.1) |
13 distinct values |
257845 |
|
12 |
X1st_Point_of_Impact |
Mean (sd) : 1.8 (1.2) |
-1 : 727 ( 0.0%) |
257845 |
|
13 |
Was_Vehicle_Left_Hand_Drive. |
Mean (sd) : 1 (0.2) |
-1 : 24068 ( 0.7%) |
257845 |
|
14 |
Journey_Purpose_of_Driver |
Mean (sd) : 8.4 (5.9) |
-1 : 44945 ( 1.4%) |
257845 |
|
15 |
Sex_of_Driver |
Mean (sd) : 1.4 (0.6) |
-1 : 52 ( 0.0%) |
257845 |
|
16 |
Age_of_Driver |
Mean (sd) : 34.4 (19.5) |
101 distinct values |
257845 |
|
17 |
Age_Band_of_Driver |
Mean (sd) : 5.9 (2.9) |
12 distinct values |
257845 |
|
18 |
Engine_Capacity_.CC. |
Mean (sd) : 1408 (1689.6) |
2881 distinct values |
257845 |
|
19 |
Propulsion_Code |
Mean (sd) : 0.8 (1.2) |
13 distinct values |
257845 |
|
20 |
Age_of_Vehicle |
Mean (sd) : 4.9 (5.4) |
99 distinct values |
257845 |
|
21 |
Driver_IMD_Decile |
Mean (sd) : 3.2 (3.8) |
11 distinct values |
257845 |
|
22 |
Driver_Home_Area_Type |
Mean (sd) : 0.9 (1.1) |
-1 : 635640 (19.5%) |
257845 |
| ï..Accident_Index | Vehicle_Reference | Casualty_Reference | Casualty_Class | Sex_of_Casualty | Age_of_Casualty | Age_Band_of_Casualty | Casualty_Severity | Pedestrian_Location | Pedestrian_Movement | Car_Passenger | Bus_or_Coach_Passenger | Pedestrian_Road_Maintenance_Worker | Casualty_Type | Casualty_Home_Area_Type |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200501BS00001 | 1 | 1 | 3 | 1 | 37 | 7 | 2 | 1 | 1 | 0 | 0 | -1 | 0 | 1 |
| 200501BS00002 | 1 | 1 | 2 | 1 | 37 | 7 | 3 | 0 | 0 | 0 | 4 | -1 | 11 | 1 |
| 200501BS00003 | 2 | 1 | 1 | 1 | 62 | 9 | 3 | 0 | 0 | 0 | 0 | -1 | 9 | 1 |
| 200501BS00004 | 1 | 1 | 3 | 1 | 30 | 6 | 3 | 5 | 2 | 0 | 0 | -1 | 0 | 1 |
| No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing |
|---|---|---|---|---|---|
1 |
ï..Accident_Index |
1. -1Â 2. 1Â 3. 10Â 4. 2Â 5. 200501BS00001Â 6. 200501BS00002Â 7. 200501BS00003Â 8. 200501BS00004Â 9. 200501BS00005Â 10. 200501BS00006Â [ 1780654 others ] |
36756 ( 1.4%)Â 18297 ( 0.7%)Â 10851 ( 0.4%)Â 17999 ( 0.7%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 1 ( 0.0%)Â 2505189 (96.8%) |
0Â (0%) |
|
2 |
Vehicle_Reference |
Mean (sd) : 1.5 (0.7) |
67 distinct values |
186189 |
|
3 |
Casualty_Reference |
Mean (sd) : 1.4 (1.4) |
97 distinct values |
186189 |
|
4 |
Casualty_Class |
Mean (sd) : 1.5 (0.7) |
1 : 1518808 (63.2%) |
186189 |
|
5 |
Sex_of_Casualty |
Mean (sd) : 1.4 (0.5) |
-1 : 691 ( 0.0%) |
186189 |
|
6 |
Age_of_Casualty |
Mean (sd) : 34.5 (18.9) |
106 distinct values |
186189 |
|
7 |
Age_Band_of_Casualty |
Mean (sd) : 6 (2.4) |
12 distinct values |
186189 |
|
8 |
Casualty_Severity |
Mean (sd) : 2.9 (0.4) |
1 : 24802 ( 1.0%) |
186189 |
|
9 |
Pedestrian_Location |
Mean (sd) : 0.7 (2) |
12 distinct values |
186189 |
|
10 |
Pedestrian_Movement |
Mean (sd) : 0.5 (1.7) |
11 distinct values |
186189 |
|
11 |
Car_Passenger |
Mean (sd) : 0.3 (0.6) |
-1 : 780 ( 0.0%) |
186189 |
|
12 |
Bus_or_Coach_Passenger |
Mean (sd) : 0.1 (0.6) |
-1 : 63 ( 0.0%) |
186189 |
|
13 |
Pedestrian_Road_Maintenance_Worker |
Mean (sd) : -0.6 (0.6) |
-1 : 1439175 (59.9%) |
186189 |
|
14 |
Casualty_Type |
Mean (sd) : 7.5 (7.2) |
21 distinct values |
186189 |
|
15 |
Casualty_Home_Area_Type |
Mean (sd) : 1 (1) |
-1 : 343872 (14.3%) |
186189 |
| Accident_Index | Longitude | Latitude | Accident_Severity | Number_of_Vehicles | Number_of_Casualties | Date | Day_of_Week | Time | Road_Type | Speed_limit | Junction_Detail | Junction_Control | Light_Conditions | Weather_Conditions | Road_Surface_Conditions | Special_Conditions_at_Site | Carriageway_Hazards | Urban_or_Rural_Area | Vehicle_Reference | Vehicle_Type | Vehicle_Manoeuvre | Junction_Location | Skidding_and_Overturning | Hit_Object_in_Carriageway | Vehicle_Leaving_Carriageway | Hit_Object_off_Carriageway | X1st_Point_of_Impact | Sex_of_Driver | Age_of_Driver | Age_Band_of_Driver | Engine_Capacity_.CC. | Age_of_Vehicle | Driver_Home_Area_Type | Casualty_Severity | Driver_Casualties_1 | Driver_Casualties_2 | Driver_Casualties_3 | Passenger_Casualties_1 | Passenger_Casualties_2 | Passenger_Casualties_3 | Pedestrian_Casualties_1 | Pedestrian_Casualties_2 | Pedestrian_Casualties_3 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200501BS00001 | -0.191170 | 51.48910 | 2 | 1 | 1 | 2005-01-04 | 3 | 17:42 | 6 | 30 | 0 | -1 | 1 | 2 | 2 | 0 | 0 | 1 | 1 | 9 | 18 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 74 | 10 | -1 | -1 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| 200501BS00002 | -0.211708 | 51.52007 | 3 | 1 | 1 | 2005-01-05 | 4 | 17:36 | 3 | 30 | 6 | 2 | 4 | 1 | 1 | 0 | 0 | 1 | 1 | 11 | 4 | 3 | 0 | 0 | 0 | 0 | 4 | 1 | 42 | 7 | 8268 | 3 | -1 | 3 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 200501BS00003 | -0.206458 | 51.52530 | 3 | 2 | 1 | 2005-01-06 | 5 | 00:15 | 6 | 30 | 0 | -1 | 4 | 1 | 1 | 0 | 0 | 1 | 1 | 11 | 17 | 0 | 0 | 4 | 0 | 0 | 4 | 1 | 35 | 6 | 8300 | 5 | 1 | NA | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 200501BS00003 | -0.206458 | 51.52530 | 3 | 2 | 1 | 2005-01-06 | 5 | 00:15 | 6 | 30 | 0 | -1 | 4 | 1 | 1 | 0 | 0 | 1 | 2 | 9 | 2 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 62 | 9 | 1762 | 6 | 1 | 3 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| No | Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing |
|---|---|---|---|---|---|
1 |
Accident_Index |
1. 200501BS00001 |
1 ( 0.0%) |
0 |
|
2 |
Longitude |
Mean (sd) : -1.4 (1.4) |
1246102 distinct values |
253 |
|
3 |
Latitude |
Mean (sd) : 52.6 (1.4) |
1168981 distinct values |
253 |
|
4 |
Accident_Severity |
Mean (sd) : 2.8 (0.4) |
1 : 47769 ( 1.4%) |
0 |
|
5 |
Number_of_Vehicles |
Mean (sd) : 2.1 (0.9) |
28 distinct values |
0 |
|
6 |
Number_of_Casualties |
Mean (sd) : 1.4 (1) |
51 distinct values |
0 |
|
7 |
Date |
min : 2005-01-01 |
4017 distinct values |
0 |
|
8 |
Day_of_Week |
Mean (sd) : 4.1 (1.9) |
1 : 354601 (10.7%) |
0 |
|
9 |
Time |
1. |
256 ( 0.0%) |
0 |
|
10 |
Road_Type |
Mean (sd) : 5.1 (1.7) |
1 : 228449 ( 6.9%) |
0 |
|
11 |
Speed_limit |
Mean (sd) : 39.6 (14.5) |
0 : 2 ( 0.0%) |
0 |
|
12 |
Junction_Detail |
Mean (sd) : 2.4 (2.6) |
-1 : 36 ( 0.0%) |
0 |
|
13 |
Junction_Control |
Mean (sd) : 1.9 (2.3) |
-1 : 1147040 (34.8%) |
0 |
|
14 |
Light_Conditions |
Mean (sd) : 1.9 (1.6) |
1 : 2455476 (74.4%) |
0 |
|
15 |
Weather_Conditions |
Mean (sd) : 1.6 (1.6) |
-1 : 299 ( 0.0%) |
0 |
|
16 |
Road_Surface_Conditions |
Mean (sd) : 1.3 (0.6) |
-1 : 4323 ( 0.1%) |
0 |
|
17 |
Special_Conditions_at_Site |
Mean (sd) : 0.1 (0.7) |
-1 : 232 ( 0.0%) |
0 |
|
18 |
Carriageway_Hazards |
Mean (sd) : 0.1 (0.6) |
-1 : 234 ( 0.0%) |
0 |
|
19 |
Urban_or_Rural_Area |
Mean (sd) : 1.4 (0.5) |
1 : 2091420 (63.4%) |
0 |
|
20 |
Vehicle_Reference |
Mean (sd) : 1.6 (0.8) |
68 distinct values |
0 |
|
21 |
Vehicle_Type |
Mean (sd) : 9.6 (8.3) |
21 distinct values |
0 |
|
22 |
Vehicle_Manoeuvre |
Mean (sd) : 12.7 (6.2) |
19 distinct values |
0 |
|
23 |
Junction_Location |
Mean (sd) : 2.5 (3.2) |
-1 : 10079 ( 0.3%) |
0 |
|
24 |
Skidding_and_Overturning |
Mean (sd) : 0.2 (0.7) |
-1 : 269 ( 0.0%) |
0 |
|
25 |
Hit_Object_in_Carriageway |
Mean (sd) : 0.3 (1.6) |
13 distinct values |
0 |
|
26 |
Vehicle_Leaving_Carriageway |
Mean (sd) : 0.4 (1.4) |
-1 : 251 ( 0.0%) |
0 |
|
27 |
Hit_Object_off_Carriageway |
Mean (sd) : 0.6 (2.1) |
13 distinct values |
0 |
|
28 |
X1st_Point_of_Impact |
Mean (sd) : 1.8 (1.2) |
-1 : 737 ( 0.0%) |
0 |
|
29 |
Sex_of_Driver |
Mean (sd) : 1.4 (0.6) |
-1 : 52 ( 0.0%) |
0 |
|
30 |
Age_of_Driver |
Mean (sd) : 34.4 (19.5) |
101 distinct values |
0 |
|
31 |
Age_Band_of_Driver |
Mean (sd) : 5.9 (2.9) |
12 distinct values |
0 |
|
32 |
Engine_Capacity_.CC. |
Mean (sd) : 1408.3 (1685.8) |
2881 distinct values |
0 |
|
33 |
Age_of_Vehicle |
Mean (sd) : 4.9 (5.4) |
99 distinct values |
0 |
|
34 |
Driver_Home_Area_Type |
Mean (sd) : 0.9 (1.1) |
-1 : 640565 (19.4%) |
0 |
|
35 |
Casualty_Severity |
Mean (sd) : 2.9 (0.4) |
1 : 23331 ( 1.1%) |
1243950 |
|
36 |
Driver_Casualties_1 |
Min : 0 |
0 : 3286101 (99.6%) |
0 |
|
37 |
Driver_Casualties_2 |
Min : 0 |
0 : 3135738 (95.0%) |
0 |
|
38 |
Driver_Casualties_3 |
Min : 0 |
0 : 1962428 (59.5%) |
0 |
|
39 |
Passenger_Casualties_1 |
Mean (sd) : 0 (0) |
0 : 3297185 (99.9%) |
0 |
|
40 |
Passenger_Casualties_2 |
Mean (sd) : 0 (0.1) |
15 distinct values |
0 |
|
41 |
Passenger_Casualties_3 |
Mean (sd) : 0.2 (0.5) |
45 distinct values |
0 |
|
42 |
Pedestrian_Casualties_1 |
Mean (sd) : 0 (0) |
0 : 3295500 (99.8%) |
0 |
|
43 |
Pedestrian_Casualties_2 |
Mean (sd) : 0 (0.1) |
0 : 3240018 (98.2%) |
0 |
|
44 |
Pedestrian_Casualties_3 |
Mean (sd) : 0.1 (0.3) |
13 distinct values |
0 |
rmAccidents=c("Location_Easting_OSGR","Location_Northing_OSGR","Police_Force","Local_Authority_.District.",
"Local_Authority_.Highway","X1st_Road_Class","X1st_Road_Number","X2nd_Road_Class",
"X2nd_Road_Number","Pedestrian_Crossing.Human_Control","Pedestrian_Crossing.Physical_Facilities",
"Did_Police_Officer_Attend_Scene_of_Accident","LSOA_of_Accident_Location")
myAccidents.clean=myAccidents[,!(names(myAccidents)%in%rmAccidents)]rmVehicles=c("Towing_and_Articulation","Vehicle_Location.Restricted_Lane","Was_Vehicle_Left_Hand_Drive.",
"Journey_Purpose_of_Driver","Propulsion_Code","Driver_IMD_Decile")
myVehicles.clean=myVehicles[,!(names(myVehicles)%in%rmVehicles)]Step 3 : Mutate casualties data into columns of casualty severity by casualty class
#1. Driver or Rider Casualties SeverityDriver_Casualties_1= myCasualties\$Casualty_Class==1 & myCasualties\$Casualty_Severity==1
Driver_Casualties_2= myCasualties\$Casualty_Class==1 & myCasualties\$Casualty_Severity==2
Driver_Casualties_3= myCasualties\$Casualty_Class==1 & myCasualties\$Casualty_Severity==3Passenger_Casualties_1 = myCasualties\$Casualty_Class==2 & myCasualties\$Casualty_Severity==1
Passenger_Casualties_2 = myCasualties\$Casualty_Class==2 & myCasualties\$Casualty_Severity==2
Passenger_Casualties_3 = myCasualties\$Casualty_Class==2 & myCasualties\$Casualty_Severity==3Pedestrian_Casualties_1 = myCasualties\$Casualty_Class==3 & myCasualties\$Casualty_Severity==1
Pedestrian_Casualties_2 = myCasualties\$Casualty_Class==3 & myCasualties\$Casualty_Severity==2
Pedestrian_Casualties_3 = myCasualties\$Casualty_Class==3 & myCasualties\$Casualty_Severity==3Mutate_Condition_1=c(Driver_Casualties_1,Driver_Casualties_2,Driver_Casualties_3,
Passenger_Casualties_1,Passenger_Casualties_2,Passenger_Casualties_3,
Pedestrian_Casualties_1,Pedestrian_Casualties_2,Pedestrian_Casualties_3)
myCasualties.clean=myCasualties%>%
mutate(Driver_Casualties_1,Driver_Casualties_2,Driver_Casualties_3,
Passenger_Casualties_1,Passenger_Casualties_2,Passenger_Casualties_3,
Pedestrian_Casualties_1,Pedestrian_Casualties_2,Pedestrian_Casualties_3)%>%
group_by(Accident_Index, Vehicle_Reference,Casualty_Severity)%>%
summarize_each(funs(sum(.,na.rm=TRUE)),Driver_Casualties_1,Driver_Casualties_2,Driver_Casualties_3,
Passenger_Casualties_1,Passenger_Casualties_2,Passenger_Casualties_3,
Pedestrian_Casualties_1,Pedestrian_Casualties_2, Pedestrian_Casualties_3)myCombined= full_join(myAccidents.clean,myVehicles.clean)
myCombined= full_join(myCombined, myCasualties.clean)myCombined = myCombined %>%mutate_each(funs(replace(.,is.na(.),0)),c(Driver_Casualties_1:Pedestrian_Casualties_3))