> #Read in Files > library(readr) > firefighter <- read_csv("~/workspace/Analysis/Firefighter.csv") Parsed with column specification: cols( `Employee Identifier` = col_integer(), Job = col_character(), Salaries = col_double(), Overtime = col_double(), `Other Salaries` = col_double(), `Total Salary` = col_double(), Retirement = col_double(), `Health/Dental` = col_double(), `Other Benefits` = col_double(), `Total Benefits` = col_double(), `Total Compensation` = col_double() ) > View(firefighter) > # firefighter has 912 observations and 11 variables > > > police <- read_csv("~/workspace/Analysis/Police.csv") Parsed with column specification: cols( `Employee Identifier` = col_integer(), Job = col_character(), Salaries = col_double(), Overtime = col_double(), `Other Salaries` = col_double(), `Total Salary` = col_double(), Retirement = col_double(), `Health/Dental` = col_double(), `Other Benefits` = col_double(), `Total Benefits` = col_double(), `Total Compensation` = col_double() ) > View(police) > # police has 889 observations and 11 variables > > #Add your code below each of the prompts below. > > #---- > #Perform Summary Analysis on Data > > # descriptive statistics for fire fighters data > summary(firefighter) Employee Identifier Job Salaries Overtime Min. : 67 Length:912 Min. : 0 Min. : 0 1st Qu.:12780 Class :character 1st Qu.: 81213 1st Qu.: 5072 Median :29510 Mode :character Median :118185 Median : 17528 Mean :28465 Mean : 97750 Mean : 24584 3rd Qu.:42704 3rd Qu.:119259 3rd Qu.: 37851 Max. :56956 Max. :158200 Max. :132729 Other Salaries Total Salary Retirement Health/Dental Other Benefits Min. : 0 Min. : 12.09 Min. : 0 Min. : 0 Min. : 0.18 1st Qu.: 7715 1st Qu.:107560.07 1st Qu.:15787 1st Qu.:15742 1st Qu.:2039.09 Median : 16491 Median :147146.52 Median :22900 Median :16823 Median :2496.17 Mean : 14616 Mean :136949.44 Mean :19195 Mean :14829 Mean :2416.43 3rd Qu.: 19989 3rd Qu.:172070.44 3rd Qu.:23428 3rd Qu.:16977 3rd Qu.:2962.63 Max. :102334 Max. :271194.59 Max. :28913 Max. :17131 Max. :4598.21 Total Benefits Total Compensation Min. : 0.18 Min. : 12.27 1st Qu.:34212.07 1st Qu.:141940.08 Median :42083.11 Median :189170.61 Mean :36440.43 Mean :173389.87 3rd Qu.:43275.88 3rd Qu.:215118.08 Max. :48121.26 Max. :316195.42 > > # descriptive statistics for police data > summary(police) Employee Identifier Job Salaries Overtime Min. : 6 Length:889 Min. : 0 Min. : 0.0 1st Qu.:14330 Class :character 1st Qu.: 47528 1st Qu.: 724.7 Median :28097 Mode :character Median : 84938 Median : 5654.8 Mean :28606 Mean : 71415 Mean : 8965.2 3rd Qu.:42819 3rd Qu.: 88124 3rd Qu.:11537.4 Max. :57025 Max. :149168 Max. :88976.0 Other Salaries Total Salary Retirement Health/Dental Other Benefits Min. : 0.0 Min. : 0 Min. : 0 Min. : 0 Min. : 0 1st Qu.: 848.1 1st Qu.: 53451 1st Qu.: 8892 1st Qu.: 7202 1st Qu.:1623 Median : 4202.2 Median : 95032 Median :15542 Median :12347 Median :2081 Mean : 4854.9 Mean : 85235 Mean :12992 Mean :10398 Mean :2342 3rd Qu.: 7546.2 3rd Qu.:111490 3rd Qu.:16390 3rd Qu.:13890 3rd Qu.:3394 Max. :32572.0 Max. :239218 Max. :27897 Max. :13890 Max. :5819 Total Benefits Total Compensation Min. : 10.44 Min. : 100.6 1st Qu.:18602.84 1st Qu.: 72268.3 Median :30660.64 Median :126645.4 Mean :25731.72 Mean :110966.9 3rd Qu.:32538.37 3rd Qu.:143007.2 Max. :44460.49 Max. :277685.4 > > > #---- > #For any 2 Data Columns, Perform Min/Max/Average Analysis for each data set and store in variable > > # chosen columns: 1. Salaries 2. Overtime > > # min salary for fire fighters > firef_min_salary <- min(firefighter$Salaries) > firef_min_salary [1] 0 > > # max salary for fire fighters > firef_max_salary <- max(firefighter$Salaries) > firef_max_salary [1] 158200.2 > > # avarage salary for fire fighters > firef_avg_salary <- mean(firefighter$Salaries) > firef_avg_salary [1] 97749.58 > > # min overtime for fire fighters > firef_min_overtime <- min(firefighter$Overtime) > firef_min_overtime [1] 0 > > # max overtime for fire fighters > firef_max_overtime <- max(firefighter$Overtime) > firef_max_overtime [1] 132728.9 > > # avarage overtime for fire fighters > firef_avg_overtime <- mean(firefighter$Overtime) > firef_avg_overtime [1] 24583.63 > > # min salary for police > police_min_salary <- min(police$Salaries) > police_min_salary [1] 0 > > # max salary for police > police_max_salary <- max(police$Salaries) > police_max_salary [1] 149167.7 > > # avarage salary for police > police_avg_salary <- mean(police$Salaries) > police_avg_salary [1] 71415.06 > > # min overtime for police > police_min_overtime <- min(police$Overtime) > police_min_overtime [1] 0 > > # max overtime for police > police_max_overtime <- max(police$Overtime) > police_max_overtime [1] 88976.01 > > # avarage overtime for police > police_avg_overtime <- mean(police$Overtime) > police_avg_overtime [1] 8965.233 > > #---- > #Compare Dataset Values > > # min salary > firef_min_salary > police_min_salary [1] FALSE > abs(firef_min_salary - police_min_salary) [1] 0 > # minimum salary for both is 0 > > # max salary > firef_max_salary > police_max_salary [1] TRUE > abs(firef_max_salary - police_max_salary) [1] 9032.5 > # fire fighter has higher max salary compared to that of police > # the difference is 9032.5 > > # average salary > firef_avg_salary > police_avg_salary [1] TRUE > abs(firef_avg_salary - police_avg_salary) [1] 26334.52 > # fire fighter has higher average salary compared to that of police > # the difference is 26334.52 > > # min overtime > firef_min_overtime > police_min_overtime [1] FALSE > abs(firef_min_overtime - police_min_overtime) [1] 0 > # minimum overtime for both is 0 > > # max overtime > firef_max_overtime > police_max_overtime [1] TRUE > abs(firef_max_overtime - police_max_overtime) [1] 43752.93 > # fire fighter has higher max overtime compared to that of police > # the difference is 43752.93 > > # average overtime > firef_avg_overtime > police_avg_overtime [1] TRUE > abs(firef_avg_overtime - police_avg_overtime) [1] 15618.39 > # fire fighter has higher average overtime compared to that of police > # the difference is 15618.39 >