Data 607 - Bar Chart Visualization Using geom_col()
By: Layla Quinones, extended by Angel Claudio
Date: 03/12/2020
Note: tidyverse, Rcurl, kableExtra, colorBrewer, and rmdformats used.
I. Abstract
ggplot2 is a ubiquitous library that allows you to easily visualize data and explain patterns in data to people who are not necessarily familiar with the technical aspect of data analysis. Visualizations made with ggplot2 are easy to understand and construct thanks to an API that allows visualizations to be “built” via layering of graphics and other visual elements. In this document we explore the a few ways we can construct bar charts to visualize categorical data, specifically using geom_col(). All other functions of ggplot2 can be found at this reference link.
II. About the Data
The data that I chose for this presentation provides information about the Incomes of U.S. Workers by Occupation and Gender. This data-set really appealed to me because I have heard some debate about the topic of gender and unequal pay, and I wanted to motivate data analysis and visualization so that it is easy for skeptics to interpret.
The following variables are included:
Occupation: Job title as given from BLS. Industry summaries are given in ALL CAPS.
All_workers: Number of workers male and female, in thousands.
All_weekly: Median weekly income including male and female workers, in USD.
M_workers: Number of male workers, in thousands.
M_weekly: Median weekly income for male workers, in USD.
F_workers: Number of female workers, in thousands.
F_weekly: Median weekly income for female workers, in USD.
DATASET SOURCE: Kaggle.com
Load the Data
url <- "https://raw.githubusercontent.com/MsQCompSci/data/master/inc_occ_gender.csv"
rawData <- getURL(url)
rawData <- read.csv(text = rawData, header = TRUE)
kable(rawData)%>%
kable_styling() %>%
scroll_box(width = "100%", height = "200px")| Occupation | All_workers | All_weekly | M_workers | M_weekly | F_workers | F_weekly |
|---|---|---|---|---|---|---|
| ALL OCCUPATIONS | 109080 | 809 | 60746 | 895 | 48334 | 726 |
| MANAGEMENT | 12480 | 1351 | 7332 | 1486 | 5147 | 1139 |
| Chief executives | 1046 | 2041 | 763 | 2251 | 283 | 1836 |
| General and operations managers | 823 | 1260 | 621 | 1347 | 202 | 1002 |
| Legislators | 8 | Na | 5 | Na | 4 | Na |
| Advertising and promotions managers | 55 | 1050 | 29 | Na | 26 | Na |
| Marketing and sales managers | 948 | 1462 | 570 | 1603 | 378 | 1258 |
| Public relations and fundraising managers | 59 | 1557 | 24 | Na | 35 | Na |
| Administrative services managers | 170 | 1191 | 96 | 1451 | 73 | 981 |
| Computer and information systems managers | 636 | 1728 | 466 | 1817 | 169 | 1563 |
| Financial managers | 1124 | 1408 | 551 | 1732 | 573 | 1130 |
| Compensation and benefits managers | 23 | Na | 7 | Na | 16 | Na |
| Human resources managers | 254 | 1365 | 68 | 1495 | 186 | 1274 |
| Training and development managers | 37 | Na | 17 | Na | 20 | Na |
| Industrial production managers | 267 | 1485 | 221 | 1528 | 45 | Na |
| Purchasing managers | 193 | 1348 | 109 | 1404 | 84 | 1226 |
| Transportation, storage, and distribution managers | 276 | 966 | 224 | 1006 | 52 | 749 |
| Farmers, ranchers, and other agricultural managers | 129 | 769 | 106 | 847 | 23 | Na |
| Construction managers | 471 | 1329 | 429 | 1357 | 42 | Na |
| Education administrators | 778 | 1423 | 282 | 1585 | 496 | 1252 |
| Architectural and engineering managers | 110 | 1899 | 101 | 1892 | 10 | Na |
| Food service managers | 763 | 742 | 389 | 820 | 374 | 680 |
| Funeral service managers | 13 | Na | 10 | Na | 2 | Na |
| Gaming managers | 19 | Na | 13 | Na | 6 | Na |
| Lodging managers | 123 | 985 | 54 | 1171 | 68 | 902 |
| Medical and health services managers | 592 | 1210 | 154 | 1422 | 438 | 1156 |
| Natural sciences managers | 24 | Na | 11 | Na | 13 | Na |
| Postmasters and mail superintendents | 20 | Na | 10 | Na | 10 | Na |
| Property, real estate, and community association managers | 401 | 914 | 171 | 1137 | 230 | 823 |
| Social and community service managers | 305 | 1022 | 105 | 1142 | 200 | 965 |
| Emergency management directors | 9 | Na | 6 | Na | 3 | Na |
| Managers, all other | 2803 | 1408 | 1717 | 1525 | 1085 | 1213 |
| BUSINESS | 5942 | 1137 | 2686 | 1327 | 3256 | 1004 |
| Agents and business managers of artists, performers, and athletes | 27 | Na | 13 | Na | 14 | Na |
| Buyers and purchasing agents, farm products | 11 | Na | 9 | Na | 2 | Na |
| Wholesale and retail buyers, except farm products | 142 | 926 | 73 | 886 | 69 | 985 |
| Purchasing agents, except wholesale, retail, and farm products | 260 | 1009 | 136 | 1020 | 124 | 986 |
| Claims adjusters, appraisers, examiners, and investigators | 317 | 963 | 141 | 1134 | 176 | 824 |
| Compliance officers | 235 | 1198 | 126 | 1375 | 109 | 1025 |
| Cost estimators | 95 | 1232 | 83 | 1264 | 12 | Na |
| Human resources workers | 592 | 1002 | 151 | 1158 | 441 | 984 |
| Compensation, benefits, and job analysis specialists | 63 | 998 | 12 | Na | 50 | 898 |
| Training and development specialists | 107 | 990 | 42 | Na | 65 | 1037 |
| Logisticians | 111 | 1028 | 66 | 1075 | 44 | Na |
| Management analysts | 529 | 1431 | 291 | 1519 | 237 | 1348 |
| Meeting, convention, and event planners | 117 | 859 | 27 | Na | 90 | 840 |
| Fundraisers | 62 | 1136 | 14 | Na | 48 | Na |
| Market research analysts and marketing specialists | 203 | 1284 | 85 | 1411 | 118 | 1239 |
| Business operations specialists, all other | 186 | 1090 | 74 | 1461 | 112 | 969 |
| Accountants and auditors | 1464 | 1132 | 618 | 1345 | 846 | 988 |
| Appraisers and assessors of real estate | 42 | Na | 21 | Na | 21 | Na |
| Budget analysts | 44 | Na | 17 | Na | 28 | Na |
| Credit analysts | 17 | Na | 8 | Na | 9 | Na |
| Financial analysts | 295 | 1426 | 168 | 1680 | 127 | 1171 |
| Personal financial advisors | 407 | 1419 | 248 | 1738 | 159 | 1033 |
| Insurance underwriters | 106 | 1149 | 44 | Na | 63 | 956 |
| Financial examiners | 17 | Na | 9 | Na | 8 | Na |
| Credit counselors and loan officers | 313 | 997 | 146 | 1186 | 166 | 906 |
| Tax examiners and collectors, and revenue agents | 59 | 1051 | 20 | Na | 39 | Na |
| Tax preparers | 56 | 892 | 19 | Na | 37 | Na |
| Financial specialists, all other | 66 | 1162 | 25 | Na | 40 | Na |
| COMPUTATIONAL | 4009 | 1428 | 3036 | 1503 | 973 | 1245 |
| Computer and information research scientists | 28 | Na | 23 | Na | 5 | Na |
| Computer systems analysts | 499 | 1389 | 325 | 1462 | 173 | 1256 |
| Information security analysts | 67 | 1538 | 56 | 1562 | 11 | Na |
| Computer programmers | 450 | 1438 | 357 | 1501 | 93 | 1302 |
| Software developers, applications and systems software | 1287 | 1682 | 1054 | 1751 | 232 | 1415 |
| Web developers | 151 | 1165 | 98 | 1233 | 53 | 1026 |
| Computer support specialists | 396 | 1079 | 291 | 1135 | 105 | 908 |
| Database administrators | 90 | 1536 | 58 | 1829 | 32 | Na |
| Network and computer systems administrators | 208 | 1242 | 179 | 1266 | 28 | Na |
| Computer network architects | 115 | 1552 | 100 | 1577 | 15 | Na |
| Computer occupations, all other | 490 | 1227 | 374 | 1252 | 116 | 1145 |
| Actuaries | 24 | Na | 18 | Na | 6 | Na |
| Mathematicians | 6 | Na | 6 | Na | 0 | Na |
| Operations research analysts | 122 | 1441 | 59 | 1574 | 63 | 1325 |
| Statisticians | 76 | 1275 | 37 | Na | 39 | Na |
| Miscellaneous mathematical science occupations | 1 | Na | 1 | Na | 0 | Na |
| ENGINEERING | 2656 | 1424 | 2272 | 1452 | 383 | 1257 |
| Architects, except naval | 138 | 1441 | 106 | 1492 | 31 | Na |
| Surveyors, cartographers, and photogrammetrists | 29 | Na | 23 | Na | 6 | Na |
| Aerospace engineers | 140 | 1662 | 122 | 1668 | 18 | Na |
| Agricultural engineers | 5 | Na | 5 | Na | 0 | Na |
| Biomedical engineers | 12 | Na | 10 | Na | 2 | Na |
| Chemical engineers | 79 | 1532 | 69 | 1583 | 10 | Na |
| Civil engineers | 316 | 1460 | 275 | 1474 | 41 | Na |
| Computer hardware engineers | 72 | 1876 | 62 | 1871 | 10 | Na |
| Electrical and electronics engineers | 283 | 1778 | 246 | 1819 | 37 | Na |
| Environmental engineers | 35 | Na | 26 | Na | 9 | Na |
| Industrial engineers, including health and safety | 205 | 1447 | 168 | 1430 | 37 | Na |
| Marine engineers and naval architects | 9 | Na | 9 | Na | 0 | Na |
| Materials engineers | 36 | Na | 33 | Na | 4 | Na |
| Mechanical engineers | 316 | 1534 | 294 | 1550 | 23 | Na |
| Mining and geological engineers, including mining safety engineers | 15 | Na | 15 | Na | 0 | Na |
| Nuclear engineers | 5 | Na | 3 | Na | 2 | Na |
| Petroleum engineers | 43 | Na | 39 | Na | 3 | Na |
| Engineers, all other | 393 | 1527 | 339 | 1537 | 54 | 1448 |
| Drafters | 114 | 977 | 91 | 977 | 23 | Na |
| Engineering technicians, except drafters | 352 | 963 | 284 | 984 | 68 | 827 |
| Surveying and mapping technicians | 58 | 1012 | 54 | 1031 | 4 | Na |
| SCIENCE | 1176 | 1206 | 662 | 1379 | 514 | 1067 |
| Agricultural and food scientists | 22 | Na | 12 | Na | 10 | Na |
| Biological scientists | 74 | 1233 | 46 | Na | 28 | Na |
| Conservation scientists and foresters | 23 | Na | 16 | Na | 7 | Na |
| Medical scientists | 151 | 1250 | 68 | 1362 | 84 | 1082 |
| Life scientists, all other | 1 | Na | 1 | Na | 0 | Na |
| Astronomers and physicists | 14 | Na | 11 | Na | 3 | Na |
| Atmospheric and space scientists | 8 | Na | 8 | Na | 1 | Na |
| Chemists and materials scientists | 93 | 1432 | 61 | 1496 | 33 | Na |
| Environmental scientists and geoscientists | 90 | 1423 | 65 | 1740 | 25 | Na |
| Physical scientists, all other | 189 | 1553 | 121 | 1770 | 68 | 1170 |
| Economists | 29 | Na | 17 | Na | 12 | Na |
| Survey researchers | 0 | Na | 0 | Na | 0 | Na |
| Psychologists | 114 | 1367 | 31 | Na | 83 | 1189 |
| Sociologists | 0 | Na | 0 | Na | 0 | Na |
| Urban and regional planners | 22 | Na | 13 | Na | 9 | Na |
| Miscellaneous social scientists and related workers | 37 | Na | 19 | Na | 19 | Na |
| Agricultural and food science technicians | 28 | Na | 21 | Na | 7 | Na |
| Biological technicians | 20 | Na | 10 | Na | 10 | Na |
| Chemical technicians | 75 | 944 | 43 | Na | 32 | Na |
| Geological and petroleum technicians | 22 | Na | 18 | Na | 4 | Na |
| Nuclear technicians | 2 | Na | 2 | Na | 0 | Na |
| Social science research assistants | 3 | Na | 0 | Na | 3 | Na |
| Miscellaneous life, physical, and social science technicians | 157 | 846 | 79 | 1001 | 78 | 780 |
| SOCIAL SERVICE | 2143 | 889 | 776 | 973 | 1367 | 845 |
| Counselors | 635 | 904 | 184 | 908 | 451 | 902 |
| Social workers | 677 | 877 | 127 | 943 | 549 | 862 |
| Probation officers and correctional treatment specialists | 85 | 967 | 42 | Na | 43 | Na |
| Social and human service assistants | 173 | 676 | 23 | Na | 149 | 673 |
| Miscellaneous community and social service specialists, including health educators and community health workers | 92 | 831 | 29 | Na | 63 | 728 |
| Clergy | 376 | 1002 | 316 | 1021 | 60 | 924 |
| Directors, religious activities and education | 62 | 929 | 31 | Na | 31 | Na |
| Religious workers, all other | 44 | Na | 23 | Na | 21 | Na |
| LEGAL | 1346 | 1391 | 624 | 1877 | 722 | 1135 |
| Lawyers | 803 | 1886 | 503 | 1914 | 300 | 1717 |
| Judicial law clerks | 11 | Na | 1 | Na | 10 | Na |
| Judges, magistrates, and other judicial workers | 54 | 1952 | 33 | Na | 20 | Na |
| Paralegals and legal assistants | 341 | 927 | 47 | Na | 294 | 910 |
| Miscellaneous legal support workers | 136 | 770 | 40 | Na | 97 | 746 |
| EDUCATION | 6884 | 956 | 1849 | 1144 | 5034 | 907 |
| Postsecondary teachers | 917 | 1258 | 516 | 1405 | 401 | 1144 |
| Preschool and kindergarten teachers | 517 | 616 | 11 | Na | 506 | 618 |
| Elementary and middle school teachers | 2806 | 974 | 543 | 1077 | 2262 | 957 |
| Secondary school teachers | 1048 | 1066 | 438 | 1149 | 610 | 1006 |
| Special education teachers | 297 | 987 | 38 | Na | 258 | 990 |
| Other teachers and instructors | 378 | 896 | 179 | 1024 | 199 | 817 |
| Archivists, curators, and museum technicians | 38 | Na | 18 | Na | 20 | Na |
| Librarians | 130 | 991 | 27 | Na | 102 | 966 |
| Library technicians | 18 | Na | 4 | Na | 15 | Na |
| Teacher assistants | 614 | 541 | 48 | Na | 565 | 530 |
| Other education, training, and library workers | 123 | 1001 | 28 | Na | 95 | 1031 |
| ARTS | 1643 | 1001 | 930 | 1088 | 713 | 942 |
| Artists and related workers | 58 | 1166 | 39 | Na | 20 | Na |
| Designers | 593 | 993 | 301 | 1099 | 291 | 918 |
| Actors | 12 | Na | 8 | Na | 4 | Na |
| Producers and directors | 120 | 1270 | 67 | 1340 | 53 | 1234 |
| Athletes, coaches, umpires, and related workers | 147 | 780 | 108 | 818 | 39 | Na |
| Dancers and choreographers | 11 | Na | 2 | Na | 9 | Na |
| Musicians, singers, and related workers | 42 | Na | 33 | Na | 9 | Na |
| Entertainers and performers, sports and related workers, all other | 14 | Na | 11 | Na | 3 | Na |
| Announcers | 25 | Na | 21 | Na | 5 | Na |
| News analysts, reporters and correspondents | 56 | 1218 | 29 | Na | 27 | Na |
| Public relations specialists | 120 | 1211 | 49 | Na | 71 | 971 |
| Editors | 108 | 1148 | 58 | 1205 | 50 | 1125 |
| Technical writers | 52 | 1158 | 22 | Na | 30 | Na |
| Writers and authors | 79 | 1232 | 36 | Na | 42 | Na |
| Miscellaneous media and communication workers | 46 | Na | 16 | Na | 30 | Na |
| Broadcast and sound engineering technicians and radio operators | 83 | 954 | 77 | 937 | 7 | Na |
| Photographers | 45 | Na | 24 | Na | 21 | Na |
| Television, video, and motion picture camera operators and editors | 30 | Na | 28 | Na | 1 | Na |
| Media and communication equipment workers, all other | 2 | Na | 2 | Na | 0 | Na |
| HEALTHCARE PROFESSIONAL | 6566 | 1041 | 1639 | 1272 | 4928 | 991 |
| Chiropractors | 22 | Na | 15 | Na | 7 | Na |
| Dentists | 59 | 1656 | 39 | Na | 20 | Na |
| Dietitians and nutritionists | 79 | 886 | 9 | Na | 69 | 879 |
| Optometrists | 19 | Na | 6 | Na | 13 | Na |
| Pharmacists | 206 | 1920 | 98 | 2117 | 108 | 1811 |
| Physicians and surgeons | 740 | 1824 | 457 | 1915 | 283 | 1533 |
| Physician assistants | 57 | 1368 | 17 | Na | 40 | Na |
| Podiatrists | 9 | Na | 5 | Na | 4 | Na |
| Audiologists | 8 | Na | 1 | Na | 6 | Na |
| Occupational therapists | 74 | 1210 | 10 | Na | 64 | 1199 |
| Physical therapists | 178 | 1265 | 56 | 1347 | 123 | 1215 |
| Radiation therapists | 12 | Na | 5 | Na | 7 | Na |
| Recreational therapists | 6 | Na | 2 | Na | 4 | Na |
| Respiratory therapists | 99 | 1000 | 32 | Na | 67 | 937 |
| Speech-language pathologists | 108 | 1147 | 1 | Na | 106 | 1148 |
| Exercise physiologists | 3 | Na | 3 | Na | 0 | Na |
| Therapists, all other | 132 | 944 | 31 | Na | 101 | 951 |
| Veterinarians | 55 | 1455 | 16 | Na | 39 | Na |
| Registered nurses | 2382 | 1116 | 278 | 1222 | 2104 | 1098 |
| Nurse anesthetists | 23 | Na | 11 | Na | 12 | Na |
| Nurse midwives | 6 | Na | 0 | Na | 6 | Na |
| Nurse practitioners | 115 | 1532 | 11 | Na | 103 | 1522 |
| Health diagnosing and treating practitioners, all other | 2 | Na | 0 | Na | 2 | Na |
| Clinical laboratory technologists and technicians | 270 | 901 | 69 | 1089 | 201 | 796 |
| Dental hygienists | 86 | 914 | 6 | Na | 80 | 953 |
| Diagnostic related technologists and technicians | 253 | 964 | 76 | 1106 | 177 | 908 |
| Emergency medical technicians and paramedics | 175 | 811 | 126 | 899 | 49 | Na |
| Health practitioner support technologists and technicians | 487 | 636 | 99 | 652 | 389 | 633 |
| Licensed practical and licensed vocational nurses | 508 | 743 | 48 | Na | 459 | 737 |
| Medical records and health information technicians | 174 | 740 | 17 | Na | 157 | 723 |
| Opticians, dispensing | 44 | Na | 21 | Na | 23 | Na |
| Miscellaneous health technologists and technicians | 99 | 671 | 32 | Na | 66 | 642 |
| Other healthcare practitioners and technical occupations | 78 | 1128 | 40 | Na | 38 | Na |
| HEALTHCARE SUPPORT | 2395 | 498 | 320 | 577 | 2074 | 490 |
| Nursing, psychiatric, and home health aides | 1400 | 467 | 163 | 526 | 1237 | 457 |
| Occupational therapy assistants and aides | 17 | Na | 4 | Na | 12 | Na |
| Physical therapist assistants and aides | 53 | 742 | 18 | Na | 35 | Na |
| Massage therapists | 37 | Na | 16 | Na | 22 | Na |
| Dental assistants | 188 | 531 | 14 | Na | 175 | 522 |
| Medical assistants | 422 | 539 | 35 | Na | 387 | 530 |
| Medical transcriptionists | 28 | Na | 3 | Na | 26 | Na |
| Pharmacy aides | 22 | Na | 4 | Na | 18 | Na |
| Veterinary assistants and laboratory animal caretakers | 21 | Na | 4 | Na | 17 | Na |
| Phlebotomists | 91 | 551 | 15 | Na | 76 | 534 |
| Miscellaneous healthcare support occupations, including medical equipment preparers | 115 | 524 | 44 | Na | 71 | 511 |
| PROTECTIVE SERVICE | 2729 | 796 | 2181 | 851 | 547 | 655 |
| First-line supervisors of correctional officers | 57 | 856 | 41 | Na | 16 | Na |
| First-line supervisors of police and detectives | 114 | 1427 | 97 | 1425 | 17 | Na |
| First-line supervisors of fire fighting and prevention workers | 42 | Na | 39 | Na | 3 | Na |
| First-line supervisors of protective service workers, all other | 72 | 808 | 56 | 825 | 16 | Na |
| Firefighters | 260 | 1033 | 245 | 1052 | 16 | Na |
| Fire inspectors | 18 | Na | 15 | Na | 3 | Na |
| Bailiffs, correctional officers, and jailers | 453 | 754 | 341 | 779 | 112 | 686 |
| Detectives and criminal investigators | 141 | 1159 | 100 | 1265 | 41 | Na |
| Fish and game wardens | 6 | Na | 5 | Na | 1 | Na |
| Parking enforcement workers | 9 | Na | 6 | Na | 3 | Na |
| Police and sheriff’s patrol officers | 655 | 1002 | 569 | 1001 | 86 | 1009 |
| Transit and railroad police | 3 | Na | 3 | Na | 0 | Na |
| Animal control workers | 4 | Na | 2 | Na | 2 | Na |
| Private detectives and investigators | 85 | 843 | 49 | Na | 36 | Na |
| Security guards and gaming surveillance officers | 708 | 567 | 555 | 592 | 153 | 515 |
| Crossing guards | 26 | Na | 13 | Na | 13 | Na |
| Transportation security screeners | 33 | Na | 22 | Na | 11 | Na |
| Lifeguards and other recreational, and all other protective service workers | 42 | Na | 24 | Na | 18 | Na |
| CULINARY | 4124 | 441 | 2133 | 481 | 1991 | 414 |
| Chefs and head cooks | 340 | 619 | 285 | 656 | 55 | 492 |
| First-line supervisors of food preparation and serving workers | 378 | 498 | 156 | 621 | 222 | 458 |
| Cooks | 1302 | 416 | 808 | 427 | 494 | 400 |
| Food preparation workers | 366 | 402 | 174 | 414 | 192 | 388 |
| Bartenders | 252 | 521 | 110 | 569 | 142 | 493 |
| Combined food preparation and serving workers, including fast food | 173 | 391 | 67 | 401 | 107 | 380 |
| Counter attendants, cafeteria, food concession, and coffee shop | 56 | 354 | 28 | Na | 28 | Na |
| Waiters and waitresses | 868 | 451 | 305 | 501 | 563 | 411 |
| Food servers, nonrestaurant | 93 | 509 | 31 | Na | 62 | 485 |
| Dining room and cafeteria attendants and bartender helpers | 107 | 403 | 59 | 389 | 48 | Na |
| Dishwashers | 117 | 398 | 98 | 401 | 19 | Na |
| Hosts and hostesses, restaurant, lounge, and coffee shop | 66 | 400 | 8 | Na | 58 | 397 |
| Food preparation and serving related workers, all other | 6 | Na | 4 | Na | 3 | Na |
| GROUNDSKEEPING | 3605 | 486 | 2330 | 517 | 1275 | 419 |
| First-line supervisors of housekeeping and janitorial workers | 172 | 620 | 108 | 700 | 64 | 571 |
| First-line supervisors of landscaping, lawn service, and groundskeeping workers | 80 | 649 | 79 | 653 | 1 | Na |
| Janitors and building cleaners | 1536 | 507 | 1111 | 547 | 425 | 429 |
| Maids and housekeeping cleaners | 876 | 416 | 134 | 475 | 742 | 407 |
| Pest control workers | 77 | 585 | 74 | 591 | 3 | Na |
| Grounds maintenance workers | 862 | 469 | 824 | 473 | 39 | Na |
| SERVICE | 2427 | 498 | 664 | 597 | 1763 | 475 |
| First-line supervisors of gaming workers | 117 | 769 | 65 | 900 | 52 | 680 |
| First-line supervisors of personal service workers | 60 | 608 | 25 | Na | 35 | Na |
| Animal trainers | 26 | Na | 19 | Na | 8 | Na |
| Nonfarm animal caretakers | 100 | 505 | 32 | Na | 68 | 501 |
| Gaming services workers | 69 | 676 | 30 | Na | 39 | Na |
| Motion picture projectionists | 3 | Na | 3 | Na | 0 | Na |
| Ushers, lobby attendants, and ticket takers | 9 | Na | 5 | Na | 4 | Na |
| Miscellaneous entertainment attendants and related workers | 69 | 485 | 42 | Na | 28 | Na |
| Embalmers and funeral attendants | 2 | Na | 2 | Na | 0 | Na |
| Morticians, undertakers, and funeral directors | 23 | Na | 17 | Na | 7 | Na |
| Barbers | 46 | Na | 33 | Na | 12 | Na |
| Hairdressers, hairstylists, and cosmetologists | 253 | 461 | 23 | Na | 229 | 463 |
| Miscellaneous personal appearance workers | 191 | 501 | 32 | Na | 159 | 497 |
| Baggage porters, bellhops, and concierges | 75 | 608 | 63 | 606 | 12 | Na |
| Tour and travel guides | 21 | Na | 11 | Na | 9 | Na |
| Childcare workers | 407 | 437 | 14 | Na | 393 | 430 |
| Personal care aides | 680 | 462 | 128 | 537 | 552 | 441 |
| Recreation and fitness workers | 185 | 555 | 78 | 684 | 107 | 526 |
| Residential advisors | 24 | Na | 8 | Na | 16 | Na |
| Personal care and service workers, all other | 67 | 499 | 35 | Na | 32 | Na |
| SALES | 9725 | 716 | 5423 | 880 | 4303 | 578 |
| First-line supervisors of retail sales workers | 2326 | 711 | 1296 | 825 | 1030 | 614 |
| First-line supervisors of non-retail sales workers | 835 | 1028 | 556 | 1140 | 280 | 896 |
| Cashiers | 1342 | 415 | 411 | 471 | 931 | 405 |
| Counter and rental clerks | 73 | 594 | 35 | Na | 37 | Na |
| Parts salespersons | 92 | 601 | 82 | 600 | 11 | Na |
| Retail salespersons | 1918 | 590 | 1159 | 694 | 759 | 494 |
| Advertising sales agents | 161 | 925 | 78 | 1155 | 83 | 729 |
| Insurance sales agents | 427 | 815 | 194 | 1028 | 232 | 717 |
| Securities, commodities, and financial services sales agents | 211 | 1155 | 146 | 1461 | 65 | 767 |
| Travel agents | 62 | 711 | 9 | Na | 53 | 685 |
| Sales representatives, services, all other | 406 | 966 | 268 | 1147 | 139 | 699 |
| Sales representatives, wholesale and manufacturing | 1138 | 1020 | 843 | 1066 | 295 | 917 |
| Models, demonstrators, and product promoters | 15 | Na | 4 | Na | 11 | Na |
| Real estate brokers and sales agents | 463 | 837 | 197 | 1052 | 266 | 735 |
| Sales engineers | 33 | Na | 31 | Na | 2 | Na |
| Telemarketers | 39 | Na | 17 | Na | 21 | Na |
| Door-to-door sales workers, news and street vendors, and related workers | 28 | Na | 9 | Na | 18 | Na |
| Sales and related workers, all other | 158 | 916 | 89 | 1088 | 70 | 727 |
| OFFICE | 13894 | 656 | 3961 | 693 | 9933 | 646 |
| First-line supervisors of office and administrative support workers | 1297 | 812 | 434 | 878 | 863 | 781 |
| Switchboard operators, including answering service | 17 | Na | 7 | Na | 10 | Na |
| Telephone operators | 22 | Na | 4 | Na | 18 | Na |
| Communications equipment operators, all other | 5 | Na | 2 | Na | 3 | Na |
| Bill and account collectors | 152 | 657 | 54 | 674 | 98 | 648 |
| Billing and posting clerks | 406 | 657 | 39 | Na | 366 | 664 |
| Bookkeeping, accounting, and auditing clerks | 769 | 692 | 87 | 690 | 682 | 692 |
| Gaming cage workers | 11 | Na | 2 | Na | 10 | Na |
| Payroll and timekeeping clerks | 128 | 757 | 17 | Na | 111 | 751 |
| Procurement clerks | 35 | Na | 15 | Na | 21 | Na |
| Tellers | 264 | 514 | 33 | Na | 231 | 516 |
| Financial clerks, all other | 61 | 767 | 30 | Na | 32 | Na |
| Brokerage clerks | 3 | Na | 1 | Na | 1 | Na |
| Correspondence clerks | 3 | Na | 1 | Na | 2 | Na |
| Court, municipal, and license clerks | 60 | 755 | 9 | Na | 51 | 743 |
| Credit authorizers, checkers, and clerks | 42 | Na | 12 | Na | 29 | Na |
| Customer service representatives | 1760 | 621 | 611 | 690 | 1149 | 604 |
| Eligibility interviewers, government programs | 67 | 781 | 17 | Na | 50 | 805 |
| File clerks | 145 | 634 | 25 | Na | 120 | 627 |
| Hotel, motel, and resort desk clerks | 127 | 481 | 58 | 486 | 69 | 467 |
| Interviewers, except eligibility and loan | 105 | 615 | 16 | Na | 89 | 617 |
| Library assistants, clerical | 35 | Na | 7 | Na | 28 | Na |
| Loan interviewers and clerks | 134 | 710 | 25 | Na | 109 | 722 |
| New accounts clerks | 20 | Na | 3 | Na | 17 | Na |
| Order clerks | 74 | 599 | 26 | Na | 48 | Na |
| Human resources assistants, except payroll and timekeeping | 50 | 737 | 11 | Na | 40 | Na |
| Receptionists and information clerks | 852 | 575 | 72 | 619 | 781 | 569 |
| Reservation and transportation ticket agents and travel clerks | 95 | 713 | 34 | Na | 61 | 680 |
| Information and record clerks, all other | 100 | 618 | 22 | Na | 78 | 616 |
| Cargo and freight agents | 20 | Na | 12 | Na | 9 | Na |
| Couriers and messengers | 153 | 752 | 134 | 750 | 19 | Na |
| Dispatchers | 250 | 698 | 109 | 759 | 141 | 655 |
| Meter readers, utilities | 39 | Na | 34 | Na | 4 | Na |
| Postal service clerks | 127 | 927 | 76 | 974 | 51 | 833 |
| Postal service mail carriers | 302 | 954 | 187 | 1021 | 115 | 854 |
| Postal service mail sorters, processors, and processing machine operators | 53 | 828 | 27 | Na | 26 | Na |
| Production, planning, and expediting clerks | 256 | 838 | 116 | 978 | 141 | 732 |
| Shipping, receiving, and traffic clerks | 502 | 591 | 354 | 604 | 148 | 566 |
| Stock clerks and order fillers | 1027 | 520 | 651 | 537 | 376 | 506 |
| Weighers, measurers, checkers, and samplers, recordkeeping | 59 | 629 | 29 | Na | 31 | Na |
| Secretaries and administrative assistants | 2223 | 687 | 124 | 786 | 2099 | 683 |
| Computer operators | 58 | 751 | 25 | Na | 33 | Na |
| Data entry keyers | 223 | 619 | 55 | 589 | 169 | 638 |
| Word processors and typists | 68 | 650 | 6 | Na | 62 | 639 |
| Desktop publishers | 1 | Na | 1 | Na | 0 | Na |
| Insurance claims and policy processing clerks | 259 | 689 | 56 | 762 | 203 | 675 |
| Mail clerks and mail machine operators, except postal service | 63 | 563 | 24 | Na | 39 | Na |
| Office clerks, general | 929 | 620 | 156 | 609 | 773 | 622 |
| Office machine operators, except computer | 31 | Na | 14 | Na | 16 | Na |
| Proofreaders and copy markers | 2 | Na | 0 | Na | 2 | Na |
| Statistical assistants | 15 | Na | 5 | Na | 10 | Na |
| Office and administrative support workers, all other | 391 | 745 | 93 | 852 | 298 | 718 |
| AGRICULTURAL | 810 | 464 | 637 | 477 | 174 | 437 |
| First-line supervisors of farming, fishing, and forestry workers | 42 | Na | 32 | Na | 10 | Na |
| Agricultural inspectors | 12 | Na | 7 | Na | 6 | Na |
| Animal breeders | 2 | Na | 2 | Na | 0 | Na |
| Graders and sorters, agricultural products | 83 | 486 | 32 | Na | 51 | 468 |
| Miscellaneous agricultural workers | 613 | 445 | 511 | 460 | 102 | 398 |
| Fishers and related fishing workers | 11 | Na | 11 | Na | 0 | Na |
| Hunters and trappers | 0 | Na | 0 | Na | 0 | Na |
| Forest and conservation workers | 15 | Na | 10 | Na | 5 | Na |
| Logging workers | 31 | Na | 31 | Na | 0 | Na |
| CONSTRUCTION | 5722 | 749 | 5586 | 751 | 137 | 704 |
| First-line supervisors of construction trades and extraction workers | 560 | 1040 | 540 | 1047 | 20 | Na |
| Boilermakers | 21 | Na | 21 | Na | 0 | Na |
| Brickmasons, blockmasons, and stonemasons | 122 | 652 | 122 | 652 | 0 | Na |
| Carpenters | 802 | 687 | 792 | 687 | 10 | Na |
| Carpet, floor, and tile installers and finishers | 89 | 637 | 89 | 634 | 1 | Na |
| Cement masons, concrete finishers, and terrazzo workers | 44 | Na | 44 | Na | 0 | Na |
| Construction laborers | 1181 | 639 | 1155 | 642 | 25 | Na |
| Paving, surfacing, and tamping equipment operators | 10 | Na | 10 | Na | 0 | Na |
| Pile-driver operators | 2 | Na | 2 | Na | 0 | Na |
| Operating engineers and other construction equipment operators | 324 | 856 | 318 | 859 | 6 | Na |
| Drywall installers, ceiling tile installers, and tapers | 121 | 596 | 119 | 595 | 2 | Na |
| Electricians | 651 | 888 | 632 | 891 | 19 | Na |
| Glaziers | 33 | Na | 32 | Na | 0 | Na |
| Insulation workers | 43 | Na | 41 | Na | 3 | Na |
| Painters, construction and maintenance | 344 | 585 | 330 | 587 | 14 | Na |
| Paperhangers | 0 | Na | 0 | Na | 0 | Na |
| Pipelayers, plumbers, pipefitters, and steamfitters | 456 | 863 | 455 | 862 | 2 | Na |
| Plasterers and stucco masons | 20 | Na | 19 | Na | 1 | Na |
| Reinforcing iron and rebar workers | 9 | Na | 9 | Na | 0 | Na |
| Roofers | 171 | 584 | 170 | 580 | 2 | Na |
| Sheet metal workers | 106 | 766 | 100 | 776 | 6 | Na |
| Structural iron and steel workers | 54 | 869 | 52 | 864 | 2 | Na |
| Solar photovoltaic installers | 8 | Na | 8 | Na | 0 | Na |
| Helpers, construction trades | 47 | Na | 47 | Na | 0 | Na |
| Construction and building inspectors | 67 | 939 | 58 | 965 | 9 | Na |
| Elevator installers and repairers | 23 | Na | 23 | Na | 0 | Na |
| Fence erectors | 33 | Na | 33 | Na | 0 | Na |
| Hazardous materials removal workers | 39 | Na | 35 | Na | 5 | Na |
| Highway maintenance workers | 91 | 754 | 91 | 755 | 0 | Na |
| Rail-track laying and maintenance equipment operators | 9 | Na | 9 | Na | 0 | Na |
| Septic tank servicers and sewer pipe cleaners | 8 | Na | 8 | Na | 0 | Na |
| Miscellaneous construction and related workers | 25 | Na | 23 | Na | 2 | Na |
| Derrick, rotary drill, and service unit operators, oil, gas, and mining | 28 | Na | 27 | Na | 1 | Na |
| Earth drillers, except oil and gas | 30 | Na | 30 | Na | 0 | Na |
| Explosives workers, ordnance handling experts, and blasters | 5 | Na | 5 | Na | 0 | Na |
| Mining machine operators | 68 | 1106 | 65 | 1098 | 2 | Na |
| Roof bolters, mining | 3 | Na | 3 | Na | 0 | Na |
| Roustabouts, oil and gas | 7 | Na | 7 | Na | 0 | Na |
| Helpers–extraction workers | 6 | Na | 6 | Na | 0 | Na |
| Other extraction workers | 61 | 900 | 58 | 918 | 3 | Na |
| MAINTENANCE | 4301 | 839 | 4159 | 842 | 143 | 761 |
| First-line supervisors of mechanics, installers, and repairers | 270 | 1032 | 252 | 1033 | 18 | Na |
| Computer, automated teller, and office machine repairers | 194 | 856 | 166 | 865 | 28 | Na |
| Radio and telecommunications equipment installers and repairers | 139 | 862 | 126 | 879 | 13 | Na |
| Avionics technicians | 4 | Na | 4 | Na | 0 | Na |
| Electric motor, power tool, and related repairers | 22 | Na | 20 | Na | 1 | Na |
| Electrical and electronics installers and repairers, transportation equipment | 2 | Na | 2 | Na | 0 | Na |
| Electrical and electronics repairers, industrial and utility | 18 | Na | 17 | Na | 0 | Na |
| Electronic equipment installers and repairers, motor vehicles | 17 | Na | 17 | Na | 0 | Na |
| Electronic home entertainment equipment installers and repairers | 30 | Na | 28 | Na | 2 | Na |
| Security and fire alarm systems installers | 67 | 911 | 65 | 913 | 2 | Na |
| Aircraft mechanics and service technicians | 133 | 1025 | 125 | 1032 | 7 | Na |
| Automotive body and related repairers | 120 | 846 | 118 | 849 | 2 | Na |
| Automotive glass installers and repairers | 21 | Na | 20 | Na | 1 | Na |
| Automotive service technicians and mechanics | 710 | 722 | 694 | 724 | 16 | Na |
| Bus and truck mechanics and diesel engine specialists | 327 | 831 | 327 | 830 | 0 | Na |
| Heavy vehicle and mobile equipment service technicians and mechanics | 206 | 928 | 206 | 928 | 0 | Na |
| Small engine mechanics | 39 | Na | 39 | Na | 0 | Na |
| Miscellaneous vehicle and mobile equipment mechanics, installers, and repairers | 66 | 592 | 65 | 591 | 1 | Na |
| Control and valve installers and repairers | 23 | Na | 23 | Na | 0 | Na |
| Heating, air conditioning, and refrigeration mechanics and installers | 341 | 806 | 337 | 810 | 4 | Na |
| Home appliance repairers | 36 | Na | 36 | Na | 0 | Na |
| Industrial and refractory machinery mechanics | 394 | 895 | 383 | 894 | 11 | Na |
| Maintenance and repair workers, general | 469 | 773 | 459 | 771 | 10 | Na |
| Maintenance workers, machinery | 31 | Na | 30 | Na | 1 | Na |
| Millwrights | 49 | Na | 48 | Na | 1 | Na |
| Electrical power-line installers and repairers | 113 | 1105 | 112 | 1105 | 0 | Na |
| Telecommunications line installers and repairers | 157 | 882 | 148 | 880 | 9 | Na |
| Precision instrument and equipment repairers | 64 | 996 | 60 | 1009 | 4 | Na |
| Wind turbine service technicians | 3 | Na | 3 | Na | 0 | Na |
| Coin, vending, and amusement machine servicers and repairers | 38 | Na | 34 | Na | 4 | Na |
| Commercial divers | 1 | Na | 1 | Na | 0 | Na |
| Locksmiths and safe repairers | 12 | Na | 12 | Na | 0 | Na |
| Manufactured building and mobile home installers | 4 | Na | 4 | Na | 1 | Na |
| Riggers | 7 | Na | 7 | Na | 0 | Na |
| Signal and track switch repairers | 9 | Na | 9 | Na | 0 | Na |
| Helpers–installation, maintenance, and repair workers | 17 | Na | 17 | Na | 0 | Na |
| Other installation, maintenance, and repair workers | 150 | 792 | 144 | 810 | 6 | Na |
| PRODUCTION | 7551 | 663 | 5548 | 729 | 2003 | 519 |
| First-line supervisors of production and operating workers | 783 | 875 | 650 | 924 | 133 | 623 |
| Aircraft structure, surfaces, rigging, and systems assemblers | 15 | Na | 11 | Na | 4 | Na |
| Electrical, electronics, and electromechanical assemblers | 123 | 554 | 59 | 566 | 64 | 544 |
| Engine and other machine assemblers | 14 | Na | 12 | Na | 2 | Na |
| Structural metal fabricators and fitters | 31 | Na | 28 | Na | 3 | Na |
| Miscellaneous assemblers and fabricators | 950 | 581 | 573 | 637 | 377 | 512 |
| Bakers | 150 | 505 | 69 | 570 | 80 | 475 |
| Butchers and other meat, poultry, and fish processing workers | 247 | 542 | 187 | 582 | 60 | 463 |
| Food and tobacco roasting, baking, and drying machine operators and tenders | 9 | Na | 7 | Na | 1 | Na |
| Food batchmakers | 79 | 500 | 25 | Na | 54 | 489 |
| Food cooking machine operators and tenders | 7 | Na | 5 | Na | 2 | Na |
| Food processing workers, all other | 132 | 594 | 82 | 679 | 50 | 508 |
| Computer control programmers and operators | 83 | 833 | 81 | 857 | 2 | Na |
| Extruding and drawing machine setters, operators, and tenders, metal and plastic | 8 | Na | 7 | Na | 1 | Na |
| Forging machine setters, operators, and tenders, metal and plastic | 6 | Na | 6 | Na | 0 | Na |
| Rolling machine setters, operators, and tenders, metal and plastic | 15 | Na | 12 | Na | 3 | Na |
| Cutting, punching, and press machine setters, operators, and tenders, metal and plastic | 78 | 633 | 62 | 674 | 15 | Na |
| Drilling and boring machine tool setters, operators, and tenders, metal and plastic | 5 | Na | 5 | Na | 1 | Na |
| Grinding, lapping, polishing, and buffing machine tool setters, operators, and tenders, metal and plastic | 41 | Na | 39 | Na | 3 | Na |
| Lathe and turning machine tool setters, operators, and tenders, metal and plastic | 12 | Na | 11 | Na | 1 | Na |
| Milling and planing machine setters, operators, and tenders, metal and plastic | 1 | Na | 1 | Na | 0 | Na |
| Machinists | 338 | 834 | 320 | 840 | 17 | Na |
| Metal furnace operators, tenders, pourers, and casters | 29 | Na | 28 | Na | 1 | Na |
| Model makers and patternmakers, metal and plastic | 6 | Na | 3 | Na | 3 | Na |
| Molders and molding machine setters, operators, and tenders, metal and plastic | 47 | Na | 39 | Na | 9 | Na |
| Multiple machine tool setters, operators, and tenders, metal and plastic | 1 | Na | 1 | Na | 0 | Na |
| Tool and die makers | 49 | Na | 49 | Na | 0 | Na |
| Welding, soldering, and brazing workers | 568 | 760 | 545 | 767 | 23 | Na |
| Heat treating equipment setters, operators, and tenders, metal and plastic | 4 | Na | 4 | Na | 0 | Na |
| Layout workers, metal and plastic | 4 | Na | 4 | Na | 1 | Na |
| Plating and coating machine setters, operators, and tenders, metal and plastic | 24 | Na | 24 | Na | 0 | Na |
| Tool grinders, filers, and sharpeners | 7 | Na | 7 | Na | 0 | Na |
| Metal workers and plastic workers, all other | 351 | 639 | 278 | 678 | 72 | 581 |
| Prepress technicians and workers | 14 | Na | 12 | Na | 2 | Na |
| Printing press operators | 160 | 707 | 134 | 729 | 26 | Na |
| Print binding and finishing workers | 16 | Na | 9 | Na | 6 | Na |
| Laundry and dry-cleaning workers | 133 | 466 | 53 | 487 | 80 | 460 |
| Pressers, textile, garment, and related materials | 21 | Na | 9 | Na | 12 | Na |
| Sewing machine operators | 147 | 493 | 42 | Na | 105 | 476 |
| Shoe and leather workers and repairers | 5 | Na | 4 | Na | 1 | Na |
| Shoe machine operators and tenders | 1 | Na | 0 | Na | 1 | Na |
| Tailors, dressmakers, and sewers | 37 | Na | 9 | Na | 27 | Na |
| Textile bleaching and dyeing machine operators and tenders | 2 | Na | 2 | Na | 0 | Na |
| Textile cutting machine setters, operators, and tenders | 9 | Na | 7 | Na | 2 | Na |
| Textile knitting and weaving machine setters, operators, and tenders | 8 | Na | 3 | Na | 4 | Na |
| Textile winding, twisting, and drawing out machine setters, operators, and tenders | 7 | Na | 5 | Na | 2 | Na |
| Extruding and forming machine setters, operators, and tenders, synthetic and glass fibers | 0 | Na | 0 | Na | 0 | Na |
| Fabric and apparel patternmakers | 4 | Na | 3 | Na | 1 | Na |
| Upholsterers | 29 | Na | 21 | Na | 7 | Na |
| Textile, apparel, and furnishings workers, all other | 16 | Na | 12 | Na | 4 | Na |
| Cabinetmakers and bench carpenters | 40 | Na | 38 | Na | 2 | Na |
| Furniture finishers | 6 | Na | 6 | Na | 0 | Na |
| Model makers and patternmakers, wood | 0 | Na | 0 | Na | 0 | Na |
| Sawing machine setters, operators, and tenders, wood | 26 | Na | 22 | Na | 4 | Na |
| Woodworking machine setters, operators, and tenders, except sawing | 23 | Na | 21 | Na | 1 | Na |
| Woodworkers, all other | 17 | Na | 14 | Na | 3 | Na |
| Power plant operators, distributors, and dispatchers | 35 | Na | 34 | Na | 1 | Na |
| Stationary engineers and boiler operators | 84 | 996 | 81 | 1012 | 3 | Na |
| Water and wastewater treatment plant and system operators | 82 | 880 | 79 | 868 | 3 | Na |
| Miscellaneous plant and system operators | 35 | Na | 33 | Na | 3 | Na |
| Chemical processing machine setters, operators, and tenders | 62 | 1052 | 57 | 1082 | 5 | Na |
| Crushing, grinding, polishing, mixing, and blending workers | 82 | 652 | 75 | 668 | 7 | Na |
| Cutting workers | 51 | 685 | 41 | Na | 9 | Na |
| Extruding, forming, pressing, and compacting machine setters, operators, and tenders | 31 | Na | 25 | Na | 6 | Na |
| Furnace, kiln, oven, drier, and kettle operators and tenders | 6 | Na | 5 | Na | 0 | Na |
| Inspectors, testers, sorters, samplers, and weighers | 701 | 710 | 440 | 844 | 260 | 583 |
| Jewelers and precious stone and metal workers | 19 | Na | 11 | Na | 7 | Na |
| Medical, dental, and ophthalmic laboratory technicians | 86 | 648 | 44 | Na | 42 | Na |
| Packaging and filling machine operators and tenders | 239 | 518 | 118 | 605 | 120 | 482 |
| Painting workers | 129 | 708 | 110 | 733 | 18 | Na |
| Photographic process workers and processing machine operators | 26 | Na | 12 | Na | 14 | Na |
| Semiconductor processors | 1 | Na | 1 | Na | 0 | Na |
| Adhesive bonding machine operators and tenders | 9 | Na | 5 | Na | 4 | Na |
| Cleaning, washing, and metal pickling equipment operators and tenders | 4 | Na | 2 | Na | 1 | Na |
| Cooling and freezing equipment operators and tenders | 4 | Na | 3 | Na | 0 | Na |
| Etchers and engravers | 12 | Na | 8 | Na | 4 | Na |
| Molders, shapers, and casters, except metal and plastic | 14 | Na | 12 | Na | 2 | Na |
| Paper goods machine setters, operators, and tenders | 27 | Na | 22 | Na | 5 | Na |
| Tire builders | 8 | Na | 8 | Na | 0 | Na |
| Helpers–production workers | 24 | Na | 18 | Na | 7 | Na |
| Production workers, all other | 846 | 625 | 643 | 666 | 203 | 501 |
| TRANSPORTATION | 6953 | 646 | 5998 | 679 | 955 | 494 |
| Supervisors of transportation and material moving workers | 186 | 894 | 153 | 898 | 33 | Na |
| Aircraft pilots and flight engineers | 114 | 1735 | 104 | 1830 | 9 | Na |
| Air traffic controllers and airfield operations specialists | 32 | Na | 24 | Na | 8 | Na |
| Flight attendants | 63 | 846 | 20 | Na | 43 | Na |
| Ambulance drivers and attendants, except emergency medical technicians | 18 | Na | 14 | Na | 4 | Na |
| Bus drivers | 323 | 615 | 184 | 681 | 138 | 572 |
| Driver/sales workers and truck drivers | 2687 | 747 | 2582 | 751 | 105 | 632 |
| Taxi drivers and chauffeurs | 253 | 585 | 216 | 600 | 38 | Na |
| Motor vehicle operators, all other | 21 | Na | 18 | Na | 3 | Na |
| Locomotive engineers and operators | 44 | Na | 42 | Na | 2 | Na |
| Railroad brake, signal, and switch operators | 5 | Na | 5 | Na | 0 | Na |
| Railroad conductors and yardmasters | 55 | 1117 | 52 | 1137 | 4 | Na |
| Subway, streetcar, and other rail transportation workers | 15 | Na | 12 | Na | 3 | Na |
| Sailors and marine oilers | 10 | Na | 9 | Na | 0 | Na |
| Ship and boat captains and operators | 29 | Na | 28 | Na | 1 | Na |
| Ship engineers | 5 | Na | 4 | Na | 1 | Na |
| Bridge and lock tenders | 4 | Na | 4 | Na | 0 | Na |
| Parking lot attendants | 57 | 492 | 49 | Na | 8 | Na |
| Automotive and watercraft service attendants | 63 | 452 | 58 | 470 | 5 | Na |
| Transportation inspectors | 21 | Na | 14 | Na | 7 | Na |
| Transportation attendants, except flight attendants | 17 | Na | 9 | Na | 8 | Na |
| Other transportation workers | 39 | Na | 35 | Na | 4 | Na |
| Conveyor operators and tenders | 7 | Na | 7 | Na | 0 | Na |
| Crane and tower operators | 75 | 988 | 71 | 1016 | 4 | Na |
| Dredge, excavating, and loading machine operators | 25 | Na | 25 | Na | 0 | Na |
| Hoist and winch operators | 5 | Na | 5 | Na | 0 | Na |
| Industrial truck and tractor operators | 579 | 609 | 541 | 612 | 37 | Na |
| Cleaners of vehicles and equipment | 222 | 485 | 200 | 498 | 22 | Na |
| Laborers and freight, stock, and material movers, hand | 1433 | 526 | 1214 | 547 | 219 | 455 |
| Machine feeders and offbearers | 30 | Na | 21 | Na | 9 | Na |
| Packers and packagers, hand | 385 | 438 | 158 | 462 | 227 | 424 |
| Pumping station operators | 18 | Na | 17 | Na | 1 | Na |
| Refuse and recyclable material collectors | 72 | 501 | 66 | 496 | 6 | Na |
| Mine shuttle car operators | 0 | Na | 0 | Na | 0 | Na |
| Tank car, truck, and ship loaders | 6 | Na | 6 | Na | 0 | Na |
| Material moving workers, all other | 37 | Na | 32 | Na | 5 | Na |
III. Visualize the Data Using GGPLOT2 Layers
The basic anatomy of ggplot2 grammer consists of raw data that has been fine tuned based on your focus, layers which include all the things that are visible about your graph (ie. data points, lines, bars, area shading, title, legend, etc), scale which stretches or shrinks the data according to your plot area, coordinate system which can be a 2d grid (but others are also possible with ggplot2) and themes which includes font, fontsize, color, etc (aesthetic component). The more you want to fine tune your visualization, the more detailed your ggplot2 grammer will be.
Context
Before you visualize any data it is a good idea to get to know the data-set. For this data set it would be interesting to compare the mean weekly income for all workers in an occupation with the mean weekly income for females and for males. For this comparison, I will choose a bar chart because it can immediately give my audience an intuitive idea of what the data is trying to show.
Format the data
Now that we have an idea about what we want to visualize and HOW we want to visualize it, we can format our data in long format and filter out any data you do not need. We will tidy data into a long format so that ggplot2 knows how to organize that data. To do this we complete the following steps:
Select only the columns of data that report weekly earnings using the
select()function a put them in a new variablePut this new data in long format using
pivot_longer()Convert all salary values from factors, to characters to numeric (must be done in that order to retain numeric value)
Drop all
NAvalues usingdrop_na()
# create a new dataframe called weekly data
weeklyData <- rawData %>%
select(Occupation, All_weekly, M_weekly, F_weekly)%>% # 1
pivot_longer(All_weekly:F_weekly, names_to = "salaryCat", values_to = "salary") #2
#3
weeklyData$salary <- as.numeric(as.character(weeklyData$salary))
#4
weeklyData <- weeklyData %>%
drop_na()
#display using kable
kable(weeklyData)%>%
kable_styling() %>%
scroll_box(width = "100%", height = "200px")| Occupation | salaryCat | salary |
|---|---|---|
| ALL OCCUPATIONS | All_weekly | 809 |
| ALL OCCUPATIONS | M_weekly | 895 |
| ALL OCCUPATIONS | F_weekly | 726 |
| MANAGEMENT | All_weekly | 1351 |
| MANAGEMENT | M_weekly | 1486 |
| MANAGEMENT | F_weekly | 1139 |
| Chief executives | All_weekly | 2041 |
| Chief executives | M_weekly | 2251 |
| Chief executives | F_weekly | 1836 |
| General and operations managers | All_weekly | 1260 |
| General and operations managers | M_weekly | 1347 |
| General and operations managers | F_weekly | 1002 |
| Advertising and promotions managers | All_weekly | 1050 |
| Marketing and sales managers | All_weekly | 1462 |
| Marketing and sales managers | M_weekly | 1603 |
| Marketing and sales managers | F_weekly | 1258 |
| Public relations and fundraising managers | All_weekly | 1557 |
| Administrative services managers | All_weekly | 1191 |
| Administrative services managers | M_weekly | 1451 |
| Administrative services managers | F_weekly | 981 |
| Computer and information systems managers | All_weekly | 1728 |
| Computer and information systems managers | M_weekly | 1817 |
| Computer and information systems managers | F_weekly | 1563 |
| Financial managers | All_weekly | 1408 |
| Financial managers | M_weekly | 1732 |
| Financial managers | F_weekly | 1130 |
| Human resources managers | All_weekly | 1365 |
| Human resources managers | M_weekly | 1495 |
| Human resources managers | F_weekly | 1274 |
| Industrial production managers | All_weekly | 1485 |
| Industrial production managers | M_weekly | 1528 |
| Purchasing managers | All_weekly | 1348 |
| Purchasing managers | M_weekly | 1404 |
| Purchasing managers | F_weekly | 1226 |
| Transportation, storage, and distribution managers | All_weekly | 966 |
| Transportation, storage, and distribution managers | M_weekly | 1006 |
| Transportation, storage, and distribution managers | F_weekly | 749 |
| Farmers, ranchers, and other agricultural managers | All_weekly | 769 |
| Farmers, ranchers, and other agricultural managers | M_weekly | 847 |
| Construction managers | All_weekly | 1329 |
| Construction managers | M_weekly | 1357 |
| Education administrators | All_weekly | 1423 |
| Education administrators | M_weekly | 1585 |
| Education administrators | F_weekly | 1252 |
| Architectural and engineering managers | All_weekly | 1899 |
| Architectural and engineering managers | M_weekly | 1892 |
| Food service managers | All_weekly | 742 |
| Food service managers | M_weekly | 820 |
| Food service managers | F_weekly | 680 |
| Lodging managers | All_weekly | 985 |
| Lodging managers | M_weekly | 1171 |
| Lodging managers | F_weekly | 902 |
| Medical and health services managers | All_weekly | 1210 |
| Medical and health services managers | M_weekly | 1422 |
| Medical and health services managers | F_weekly | 1156 |
| Property, real estate, and community association managers | All_weekly | 914 |
| Property, real estate, and community association managers | M_weekly | 1137 |
| Property, real estate, and community association managers | F_weekly | 823 |
| Social and community service managers | All_weekly | 1022 |
| Social and community service managers | M_weekly | 1142 |
| Social and community service managers | F_weekly | 965 |
| Managers, all other | All_weekly | 1408 |
| Managers, all other | M_weekly | 1525 |
| Managers, all other | F_weekly | 1213 |
| BUSINESS | All_weekly | 1137 |
| BUSINESS | M_weekly | 1327 |
| BUSINESS | F_weekly | 1004 |
| Wholesale and retail buyers, except farm products | All_weekly | 926 |
| Wholesale and retail buyers, except farm products | M_weekly | 886 |
| Wholesale and retail buyers, except farm products | F_weekly | 985 |
| Purchasing agents, except wholesale, retail, and farm products | All_weekly | 1009 |
| Purchasing agents, except wholesale, retail, and farm products | M_weekly | 1020 |
| Purchasing agents, except wholesale, retail, and farm products | F_weekly | 986 |
| Claims adjusters, appraisers, examiners, and investigators | All_weekly | 963 |
| Claims adjusters, appraisers, examiners, and investigators | M_weekly | 1134 |
| Claims adjusters, appraisers, examiners, and investigators | F_weekly | 824 |
| Compliance officers | All_weekly | 1198 |
| Compliance officers | M_weekly | 1375 |
| Compliance officers | F_weekly | 1025 |
| Cost estimators | All_weekly | 1232 |
| Cost estimators | M_weekly | 1264 |
| Human resources workers | All_weekly | 1002 |
| Human resources workers | M_weekly | 1158 |
| Human resources workers | F_weekly | 984 |
| Compensation, benefits, and job analysis specialists | All_weekly | 998 |
| Compensation, benefits, and job analysis specialists | F_weekly | 898 |
| Training and development specialists | All_weekly | 990 |
| Training and development specialists | F_weekly | 1037 |
| Logisticians | All_weekly | 1028 |
| Logisticians | M_weekly | 1075 |
| Management analysts | All_weekly | 1431 |
| Management analysts | M_weekly | 1519 |
| Management analysts | F_weekly | 1348 |
| Meeting, convention, and event planners | All_weekly | 859 |
| Meeting, convention, and event planners | F_weekly | 840 |
| Fundraisers | All_weekly | 1136 |
| Market research analysts and marketing specialists | All_weekly | 1284 |
| Market research analysts and marketing specialists | M_weekly | 1411 |
| Market research analysts and marketing specialists | F_weekly | 1239 |
| Business operations specialists, all other | All_weekly | 1090 |
| Business operations specialists, all other | M_weekly | 1461 |
| Business operations specialists, all other | F_weekly | 969 |
| Accountants and auditors | All_weekly | 1132 |
| Accountants and auditors | M_weekly | 1345 |
| Accountants and auditors | F_weekly | 988 |
| Financial analysts | All_weekly | 1426 |
| Financial analysts | M_weekly | 1680 |
| Financial analysts | F_weekly | 1171 |
| Personal financial advisors | All_weekly | 1419 |
| Personal financial advisors | M_weekly | 1738 |
| Personal financial advisors | F_weekly | 1033 |
| Insurance underwriters | All_weekly | 1149 |
| Insurance underwriters | F_weekly | 956 |
| Credit counselors and loan officers | All_weekly | 997 |
| Credit counselors and loan officers | M_weekly | 1186 |
| Credit counselors and loan officers | F_weekly | 906 |
| Tax examiners and collectors, and revenue agents | All_weekly | 1051 |
| Tax preparers | All_weekly | 892 |
| Financial specialists, all other | All_weekly | 1162 |
| COMPUTATIONAL | All_weekly | 1428 |
| COMPUTATIONAL | M_weekly | 1503 |
| COMPUTATIONAL | F_weekly | 1245 |
| Computer systems analysts | All_weekly | 1389 |
| Computer systems analysts | M_weekly | 1462 |
| Computer systems analysts | F_weekly | 1256 |
| Information security analysts | All_weekly | 1538 |
| Information security analysts | M_weekly | 1562 |
| Computer programmers | All_weekly | 1438 |
| Computer programmers | M_weekly | 1501 |
| Computer programmers | F_weekly | 1302 |
| Software developers, applications and systems software | All_weekly | 1682 |
| Software developers, applications and systems software | M_weekly | 1751 |
| Software developers, applications and systems software | F_weekly | 1415 |
| Web developers | All_weekly | 1165 |
| Web developers | M_weekly | 1233 |
| Web developers | F_weekly | 1026 |
| Computer support specialists | All_weekly | 1079 |
| Computer support specialists | M_weekly | 1135 |
| Computer support specialists | F_weekly | 908 |
| Database administrators | All_weekly | 1536 |
| Database administrators | M_weekly | 1829 |
| Network and computer systems administrators | All_weekly | 1242 |
| Network and computer systems administrators | M_weekly | 1266 |
| Computer network architects | All_weekly | 1552 |
| Computer network architects | M_weekly | 1577 |
| Computer occupations, all other | All_weekly | 1227 |
| Computer occupations, all other | M_weekly | 1252 |
| Computer occupations, all other | F_weekly | 1145 |
| Operations research analysts | All_weekly | 1441 |
| Operations research analysts | M_weekly | 1574 |
| Operations research analysts | F_weekly | 1325 |
| Statisticians | All_weekly | 1275 |
| ENGINEERING | All_weekly | 1424 |
| ENGINEERING | M_weekly | 1452 |
| ENGINEERING | F_weekly | 1257 |
| Architects, except naval | All_weekly | 1441 |
| Architects, except naval | M_weekly | 1492 |
| Aerospace engineers | All_weekly | 1662 |
| Aerospace engineers | M_weekly | 1668 |
| Chemical engineers | All_weekly | 1532 |
| Chemical engineers | M_weekly | 1583 |
| Civil engineers | All_weekly | 1460 |
| Civil engineers | M_weekly | 1474 |
| Computer hardware engineers | All_weekly | 1876 |
| Computer hardware engineers | M_weekly | 1871 |
| Electrical and electronics engineers | All_weekly | 1778 |
| Electrical and electronics engineers | M_weekly | 1819 |
| Industrial engineers, including health and safety | All_weekly | 1447 |
| Industrial engineers, including health and safety | M_weekly | 1430 |
| Mechanical engineers | All_weekly | 1534 |
| Mechanical engineers | M_weekly | 1550 |
| Engineers, all other | All_weekly | 1527 |
| Engineers, all other | M_weekly | 1537 |
| Engineers, all other | F_weekly | 1448 |
| Drafters | All_weekly | 977 |
| Drafters | M_weekly | 977 |
| Engineering technicians, except drafters | All_weekly | 963 |
| Engineering technicians, except drafters | M_weekly | 984 |
| Engineering technicians, except drafters | F_weekly | 827 |
| Surveying and mapping technicians | All_weekly | 1012 |
| Surveying and mapping technicians | M_weekly | 1031 |
| SCIENCE | All_weekly | 1206 |
| SCIENCE | M_weekly | 1379 |
| SCIENCE | F_weekly | 1067 |
| Biological scientists | All_weekly | 1233 |
| Medical scientists | All_weekly | 1250 |
| Medical scientists | M_weekly | 1362 |
| Medical scientists | F_weekly | 1082 |
| Chemists and materials scientists | All_weekly | 1432 |
| Chemists and materials scientists | M_weekly | 1496 |
| Environmental scientists and geoscientists | All_weekly | 1423 |
| Environmental scientists and geoscientists | M_weekly | 1740 |
| Physical scientists, all other | All_weekly | 1553 |
| Physical scientists, all other | M_weekly | 1770 |
| Physical scientists, all other | F_weekly | 1170 |
| Psychologists | All_weekly | 1367 |
| Psychologists | F_weekly | 1189 |
| Chemical technicians | All_weekly | 944 |
| Miscellaneous life, physical, and social science technicians | All_weekly | 846 |
| Miscellaneous life, physical, and social science technicians | M_weekly | 1001 |
| Miscellaneous life, physical, and social science technicians | F_weekly | 780 |
| SOCIAL SERVICE | All_weekly | 889 |
| SOCIAL SERVICE | M_weekly | 973 |
| SOCIAL SERVICE | F_weekly | 845 |
| Counselors | All_weekly | 904 |
| Counselors | M_weekly | 908 |
| Counselors | F_weekly | 902 |
| Social workers | All_weekly | 877 |
| Social workers | M_weekly | 943 |
| Social workers | F_weekly | 862 |
| Probation officers and correctional treatment specialists | All_weekly | 967 |
| Social and human service assistants | All_weekly | 676 |
| Social and human service assistants | F_weekly | 673 |
| Miscellaneous community and social service specialists, including health educators and community health workers | All_weekly | 831 |
| Miscellaneous community and social service specialists, including health educators and community health workers | F_weekly | 728 |
| Clergy | All_weekly | 1002 |
| Clergy | M_weekly | 1021 |
| Clergy | F_weekly | 924 |
| Directors, religious activities and education | All_weekly | 929 |
| LEGAL | All_weekly | 1391 |
| LEGAL | M_weekly | 1877 |
| LEGAL | F_weekly | 1135 |
| Lawyers | All_weekly | 1886 |
| Lawyers | M_weekly | 1914 |
| Lawyers | F_weekly | 1717 |
| Judges, magistrates, and other judicial workers | All_weekly | 1952 |
| Paralegals and legal assistants | All_weekly | 927 |
| Paralegals and legal assistants | F_weekly | 910 |
| Miscellaneous legal support workers | All_weekly | 770 |
| Miscellaneous legal support workers | F_weekly | 746 |
| EDUCATION | All_weekly | 956 |
| EDUCATION | M_weekly | 1144 |
| EDUCATION | F_weekly | 907 |
| Postsecondary teachers | All_weekly | 1258 |
| Postsecondary teachers | M_weekly | 1405 |
| Postsecondary teachers | F_weekly | 1144 |
| Preschool and kindergarten teachers | All_weekly | 616 |
| Preschool and kindergarten teachers | F_weekly | 618 |
| Elementary and middle school teachers | All_weekly | 974 |
| Elementary and middle school teachers | M_weekly | 1077 |
| Elementary and middle school teachers | F_weekly | 957 |
| Secondary school teachers | All_weekly | 1066 |
| Secondary school teachers | M_weekly | 1149 |
| Secondary school teachers | F_weekly | 1006 |
| Special education teachers | All_weekly | 987 |
| Special education teachers | F_weekly | 990 |
| Other teachers and instructors | All_weekly | 896 |
| Other teachers and instructors | M_weekly | 1024 |
| Other teachers and instructors | F_weekly | 817 |
| Librarians | All_weekly | 991 |
| Librarians | F_weekly | 966 |
| Teacher assistants | All_weekly | 541 |
| Teacher assistants | F_weekly | 530 |
| Other education, training, and library workers | All_weekly | 1001 |
| Other education, training, and library workers | F_weekly | 1031 |
| ARTS | All_weekly | 1001 |
| ARTS | M_weekly | 1088 |
| ARTS | F_weekly | 942 |
| Artists and related workers | All_weekly | 1166 |
| Designers | All_weekly | 993 |
| Designers | M_weekly | 1099 |
| Designers | F_weekly | 918 |
| Producers and directors | All_weekly | 1270 |
| Producers and directors | M_weekly | 1340 |
| Producers and directors | F_weekly | 1234 |
| Athletes, coaches, umpires, and related workers | All_weekly | 780 |
| Athletes, coaches, umpires, and related workers | M_weekly | 818 |
| News analysts, reporters and correspondents | All_weekly | 1218 |
| Public relations specialists | All_weekly | 1211 |
| Public relations specialists | F_weekly | 971 |
| Editors | All_weekly | 1148 |
| Editors | M_weekly | 1205 |
| Editors | F_weekly | 1125 |
| Technical writers | All_weekly | 1158 |
| Writers and authors | All_weekly | 1232 |
| Broadcast and sound engineering technicians and radio operators | All_weekly | 954 |
| Broadcast and sound engineering technicians and radio operators | M_weekly | 937 |
| HEALTHCARE PROFESSIONAL | All_weekly | 1041 |
| HEALTHCARE PROFESSIONAL | M_weekly | 1272 |
| HEALTHCARE PROFESSIONAL | F_weekly | 991 |
| Dentists | All_weekly | 1656 |
| Dietitians and nutritionists | All_weekly | 886 |
| Dietitians and nutritionists | F_weekly | 879 |
| Pharmacists | All_weekly | 1920 |
| Pharmacists | M_weekly | 2117 |
| Pharmacists | F_weekly | 1811 |
| Physicians and surgeons | All_weekly | 1824 |
| Physicians and surgeons | M_weekly | 1915 |
| Physicians and surgeons | F_weekly | 1533 |
| Physician assistants | All_weekly | 1368 |
| Occupational therapists | All_weekly | 1210 |
| Occupational therapists | F_weekly | 1199 |
| Physical therapists | All_weekly | 1265 |
| Physical therapists | M_weekly | 1347 |
| Physical therapists | F_weekly | 1215 |
| Respiratory therapists | All_weekly | 1000 |
| Respiratory therapists | F_weekly | 937 |
| Speech-language pathologists | All_weekly | 1147 |
| Speech-language pathologists | F_weekly | 1148 |
| Therapists, all other | All_weekly | 944 |
| Therapists, all other | F_weekly | 951 |
| Veterinarians | All_weekly | 1455 |
| Registered nurses | All_weekly | 1116 |
| Registered nurses | M_weekly | 1222 |
| Registered nurses | F_weekly | 1098 |
| Nurse practitioners | All_weekly | 1532 |
| Nurse practitioners | F_weekly | 1522 |
| Clinical laboratory technologists and technicians | All_weekly | 901 |
| Clinical laboratory technologists and technicians | M_weekly | 1089 |
| Clinical laboratory technologists and technicians | F_weekly | 796 |
| Dental hygienists | All_weekly | 914 |
| Dental hygienists | F_weekly | 953 |
| Diagnostic related technologists and technicians | All_weekly | 964 |
| Diagnostic related technologists and technicians | M_weekly | 1106 |
| Diagnostic related technologists and technicians | F_weekly | 908 |
| Emergency medical technicians and paramedics | All_weekly | 811 |
| Emergency medical technicians and paramedics | M_weekly | 899 |
| Health practitioner support technologists and technicians | All_weekly | 636 |
| Health practitioner support technologists and technicians | M_weekly | 652 |
| Health practitioner support technologists and technicians | F_weekly | 633 |
| Licensed practical and licensed vocational nurses | All_weekly | 743 |
| Licensed practical and licensed vocational nurses | F_weekly | 737 |
| Medical records and health information technicians | All_weekly | 740 |
| Medical records and health information technicians | F_weekly | 723 |
| Miscellaneous health technologists and technicians | All_weekly | 671 |
| Miscellaneous health technologists and technicians | F_weekly | 642 |
| Other healthcare practitioners and technical occupations | All_weekly | 1128 |
| HEALTHCARE SUPPORT | All_weekly | 498 |
| HEALTHCARE SUPPORT | M_weekly | 577 |
| HEALTHCARE SUPPORT | F_weekly | 490 |
| Nursing, psychiatric, and home health aides | All_weekly | 467 |
| Nursing, psychiatric, and home health aides | M_weekly | 526 |
| Nursing, psychiatric, and home health aides | F_weekly | 457 |
| Physical therapist assistants and aides | All_weekly | 742 |
| Dental assistants | All_weekly | 531 |
| Dental assistants | F_weekly | 522 |
| Medical assistants | All_weekly | 539 |
| Medical assistants | F_weekly | 530 |
| Phlebotomists | All_weekly | 551 |
| Phlebotomists | F_weekly | 534 |
| Miscellaneous healthcare support occupations, including medical equipment preparers | All_weekly | 524 |
| Miscellaneous healthcare support occupations, including medical equipment preparers | F_weekly | 511 |
| PROTECTIVE SERVICE | All_weekly | 796 |
| PROTECTIVE SERVICE | M_weekly | 851 |
| PROTECTIVE SERVICE | F_weekly | 655 |
| First-line supervisors of correctional officers | All_weekly | 856 |
| First-line supervisors of police and detectives | All_weekly | 1427 |
| First-line supervisors of police and detectives | M_weekly | 1425 |
| First-line supervisors of protective service workers, all other | All_weekly | 808 |
| First-line supervisors of protective service workers, all other | M_weekly | 825 |
| Firefighters | All_weekly | 1033 |
| Firefighters | M_weekly | 1052 |
| Bailiffs, correctional officers, and jailers | All_weekly | 754 |
| Bailiffs, correctional officers, and jailers | M_weekly | 779 |
| Bailiffs, correctional officers, and jailers | F_weekly | 686 |
| Detectives and criminal investigators | All_weekly | 1159 |
| Detectives and criminal investigators | M_weekly | 1265 |
| Police and sheriff’s patrol officers | All_weekly | 1002 |
| Police and sheriff’s patrol officers | M_weekly | 1001 |
| Police and sheriff’s patrol officers | F_weekly | 1009 |
| Private detectives and investigators | All_weekly | 843 |
| Security guards and gaming surveillance officers | All_weekly | 567 |
| Security guards and gaming surveillance officers | M_weekly | 592 |
| Security guards and gaming surveillance officers | F_weekly | 515 |
| CULINARY | All_weekly | 441 |
| CULINARY | M_weekly | 481 |
| CULINARY | F_weekly | 414 |
| Chefs and head cooks | All_weekly | 619 |
| Chefs and head cooks | M_weekly | 656 |
| Chefs and head cooks | F_weekly | 492 |
| First-line supervisors of food preparation and serving workers | All_weekly | 498 |
| First-line supervisors of food preparation and serving workers | M_weekly | 621 |
| First-line supervisors of food preparation and serving workers | F_weekly | 458 |
| Cooks | All_weekly | 416 |
| Cooks | M_weekly | 427 |
| Cooks | F_weekly | 400 |
| Food preparation workers | All_weekly | 402 |
| Food preparation workers | M_weekly | 414 |
| Food preparation workers | F_weekly | 388 |
| Bartenders | All_weekly | 521 |
| Bartenders | M_weekly | 569 |
| Bartenders | F_weekly | 493 |
| Combined food preparation and serving workers, including fast food | All_weekly | 391 |
| Combined food preparation and serving workers, including fast food | M_weekly | 401 |
| Combined food preparation and serving workers, including fast food | F_weekly | 380 |
| Counter attendants, cafeteria, food concession, and coffee shop | All_weekly | 354 |
| Waiters and waitresses | All_weekly | 451 |
| Waiters and waitresses | M_weekly | 501 |
| Waiters and waitresses | F_weekly | 411 |
| Food servers, nonrestaurant | All_weekly | 509 |
| Food servers, nonrestaurant | F_weekly | 485 |
| Dining room and cafeteria attendants and bartender helpers | All_weekly | 403 |
| Dining room and cafeteria attendants and bartender helpers | M_weekly | 389 |
| Dishwashers | All_weekly | 398 |
| Dishwashers | M_weekly | 401 |
| Hosts and hostesses, restaurant, lounge, and coffee shop | All_weekly | 400 |
| Hosts and hostesses, restaurant, lounge, and coffee shop | F_weekly | 397 |
| GROUNDSKEEPING | All_weekly | 486 |
| GROUNDSKEEPING | M_weekly | 517 |
| GROUNDSKEEPING | F_weekly | 419 |
| First-line supervisors of housekeeping and janitorial workers | All_weekly | 620 |
| First-line supervisors of housekeeping and janitorial workers | M_weekly | 700 |
| First-line supervisors of housekeeping and janitorial workers | F_weekly | 571 |
| First-line supervisors of landscaping, lawn service, and groundskeeping workers | All_weekly | 649 |
| First-line supervisors of landscaping, lawn service, and groundskeeping workers | M_weekly | 653 |
| Janitors and building cleaners | All_weekly | 507 |
| Janitors and building cleaners | M_weekly | 547 |
| Janitors and building cleaners | F_weekly | 429 |
| Maids and housekeeping cleaners | All_weekly | 416 |
| Maids and housekeeping cleaners | M_weekly | 475 |
| Maids and housekeeping cleaners | F_weekly | 407 |
| Pest control workers | All_weekly | 585 |
| Pest control workers | M_weekly | 591 |
| Grounds maintenance workers | All_weekly | 469 |
| Grounds maintenance workers | M_weekly | 473 |
| SERVICE | All_weekly | 498 |
| SERVICE | M_weekly | 597 |
| SERVICE | F_weekly | 475 |
| First-line supervisors of gaming workers | All_weekly | 769 |
| First-line supervisors of gaming workers | M_weekly | 900 |
| First-line supervisors of gaming workers | F_weekly | 680 |
| First-line supervisors of personal service workers | All_weekly | 608 |
| Nonfarm animal caretakers | All_weekly | 505 |
| Nonfarm animal caretakers | F_weekly | 501 |
| Gaming services workers | All_weekly | 676 |
| Miscellaneous entertainment attendants and related workers | All_weekly | 485 |
| Hairdressers, hairstylists, and cosmetologists | All_weekly | 461 |
| Hairdressers, hairstylists, and cosmetologists | F_weekly | 463 |
| Miscellaneous personal appearance workers | All_weekly | 501 |
| Miscellaneous personal appearance workers | F_weekly | 497 |
| Baggage porters, bellhops, and concierges | All_weekly | 608 |
| Baggage porters, bellhops, and concierges | M_weekly | 606 |
| Childcare workers | All_weekly | 437 |
| Childcare workers | F_weekly | 430 |
| Personal care aides | All_weekly | 462 |
| Personal care aides | M_weekly | 537 |
| Personal care aides | F_weekly | 441 |
| Recreation and fitness workers | All_weekly | 555 |
| Recreation and fitness workers | M_weekly | 684 |
| Recreation and fitness workers | F_weekly | 526 |
| Personal care and service workers, all other | All_weekly | 499 |
| SALES | All_weekly | 716 |
| SALES | M_weekly | 880 |
| SALES | F_weekly | 578 |
| First-line supervisors of retail sales workers | All_weekly | 711 |
| First-line supervisors of retail sales workers | M_weekly | 825 |
| First-line supervisors of retail sales workers | F_weekly | 614 |
| First-line supervisors of non-retail sales workers | All_weekly | 1028 |
| First-line supervisors of non-retail sales workers | M_weekly | 1140 |
| First-line supervisors of non-retail sales workers | F_weekly | 896 |
| Cashiers | All_weekly | 415 |
| Cashiers | M_weekly | 471 |
| Cashiers | F_weekly | 405 |
| Counter and rental clerks | All_weekly | 594 |
| Parts salespersons | All_weekly | 601 |
| Parts salespersons | M_weekly | 600 |
| Retail salespersons | All_weekly | 590 |
| Retail salespersons | M_weekly | 694 |
| Retail salespersons | F_weekly | 494 |
| Advertising sales agents | All_weekly | 925 |
| Advertising sales agents | M_weekly | 1155 |
| Advertising sales agents | F_weekly | 729 |
| Insurance sales agents | All_weekly | 815 |
| Insurance sales agents | M_weekly | 1028 |
| Insurance sales agents | F_weekly | 717 |
| Securities, commodities, and financial services sales agents | All_weekly | 1155 |
| Securities, commodities, and financial services sales agents | M_weekly | 1461 |
| Securities, commodities, and financial services sales agents | F_weekly | 767 |
| Travel agents | All_weekly | 711 |
| Travel agents | F_weekly | 685 |
| Sales representatives, services, all other | All_weekly | 966 |
| Sales representatives, services, all other | M_weekly | 1147 |
| Sales representatives, services, all other | F_weekly | 699 |
| Sales representatives, wholesale and manufacturing | All_weekly | 1020 |
| Sales representatives, wholesale and manufacturing | M_weekly | 1066 |
| Sales representatives, wholesale and manufacturing | F_weekly | 917 |
| Real estate brokers and sales agents | All_weekly | 837 |
| Real estate brokers and sales agents | M_weekly | 1052 |
| Real estate brokers and sales agents | F_weekly | 735 |
| Sales and related workers, all other | All_weekly | 916 |
| Sales and related workers, all other | M_weekly | 1088 |
| Sales and related workers, all other | F_weekly | 727 |
| OFFICE | All_weekly | 656 |
| OFFICE | M_weekly | 693 |
| OFFICE | F_weekly | 646 |
| First-line supervisors of office and administrative support workers | All_weekly | 812 |
| First-line supervisors of office and administrative support workers | M_weekly | 878 |
| First-line supervisors of office and administrative support workers | F_weekly | 781 |
| Bill and account collectors | All_weekly | 657 |
| Bill and account collectors | M_weekly | 674 |
| Bill and account collectors | F_weekly | 648 |
| Billing and posting clerks | All_weekly | 657 |
| Billing and posting clerks | F_weekly | 664 |
| Bookkeeping, accounting, and auditing clerks | All_weekly | 692 |
| Bookkeeping, accounting, and auditing clerks | M_weekly | 690 |
| Bookkeeping, accounting, and auditing clerks | F_weekly | 692 |
| Payroll and timekeeping clerks | All_weekly | 757 |
| Payroll and timekeeping clerks | F_weekly | 751 |
| Tellers | All_weekly | 514 |
| Tellers | F_weekly | 516 |
| Financial clerks, all other | All_weekly | 767 |
| Court, municipal, and license clerks | All_weekly | 755 |
| Court, municipal, and license clerks | F_weekly | 743 |
| Customer service representatives | All_weekly | 621 |
| Customer service representatives | M_weekly | 690 |
| Customer service representatives | F_weekly | 604 |
| Eligibility interviewers, government programs | All_weekly | 781 |
| Eligibility interviewers, government programs | F_weekly | 805 |
| File clerks | All_weekly | 634 |
| File clerks | F_weekly | 627 |
| Hotel, motel, and resort desk clerks | All_weekly | 481 |
| Hotel, motel, and resort desk clerks | M_weekly | 486 |
| Hotel, motel, and resort desk clerks | F_weekly | 467 |
| Interviewers, except eligibility and loan | All_weekly | 615 |
| Interviewers, except eligibility and loan | F_weekly | 617 |
| Loan interviewers and clerks | All_weekly | 710 |
| Loan interviewers and clerks | F_weekly | 722 |
| Order clerks | All_weekly | 599 |
| Human resources assistants, except payroll and timekeeping | All_weekly | 737 |
| Receptionists and information clerks | All_weekly | 575 |
| Receptionists and information clerks | M_weekly | 619 |
| Receptionists and information clerks | F_weekly | 569 |
| Reservation and transportation ticket agents and travel clerks | All_weekly | 713 |
| Reservation and transportation ticket agents and travel clerks | F_weekly | 680 |
| Information and record clerks, all other | All_weekly | 618 |
| Information and record clerks, all other | F_weekly | 616 |
| Couriers and messengers | All_weekly | 752 |
| Couriers and messengers | M_weekly | 750 |
| Dispatchers | All_weekly | 698 |
| Dispatchers | M_weekly | 759 |
| Dispatchers | F_weekly | 655 |
| Postal service clerks | All_weekly | 927 |
| Postal service clerks | M_weekly | 974 |
| Postal service clerks | F_weekly | 833 |
| Postal service mail carriers | All_weekly | 954 |
| Postal service mail carriers | M_weekly | 1021 |
| Postal service mail carriers | F_weekly | 854 |
| Postal service mail sorters, processors, and processing machine operators | All_weekly | 828 |
| Production, planning, and expediting clerks | All_weekly | 838 |
| Production, planning, and expediting clerks | M_weekly | 978 |
| Production, planning, and expediting clerks | F_weekly | 732 |
| Shipping, receiving, and traffic clerks | All_weekly | 591 |
| Shipping, receiving, and traffic clerks | M_weekly | 604 |
| Shipping, receiving, and traffic clerks | F_weekly | 566 |
| Stock clerks and order fillers | All_weekly | 520 |
| Stock clerks and order fillers | M_weekly | 537 |
| Stock clerks and order fillers | F_weekly | 506 |
| Weighers, measurers, checkers, and samplers, recordkeeping | All_weekly | 629 |
| Secretaries and administrative assistants | All_weekly | 687 |
| Secretaries and administrative assistants | M_weekly | 786 |
| Secretaries and administrative assistants | F_weekly | 683 |
| Computer operators | All_weekly | 751 |
| Data entry keyers | All_weekly | 619 |
| Data entry keyers | M_weekly | 589 |
| Data entry keyers | F_weekly | 638 |
| Word processors and typists | All_weekly | 650 |
| Word processors and typists | F_weekly | 639 |
| Insurance claims and policy processing clerks | All_weekly | 689 |
| Insurance claims and policy processing clerks | M_weekly | 762 |
| Insurance claims and policy processing clerks | F_weekly | 675 |
| Mail clerks and mail machine operators, except postal service | All_weekly | 563 |
| Office clerks, general | All_weekly | 620 |
| Office clerks, general | M_weekly | 609 |
| Office clerks, general | F_weekly | 622 |
| Office and administrative support workers, all other | All_weekly | 745 |
| Office and administrative support workers, all other | M_weekly | 852 |
| Office and administrative support workers, all other | F_weekly | 718 |
| AGRICULTURAL | All_weekly | 464 |
| AGRICULTURAL | M_weekly | 477 |
| AGRICULTURAL | F_weekly | 437 |
| Graders and sorters, agricultural products | All_weekly | 486 |
| Graders and sorters, agricultural products | F_weekly | 468 |
| Miscellaneous agricultural workers | All_weekly | 445 |
| Miscellaneous agricultural workers | M_weekly | 460 |
| Miscellaneous agricultural workers | F_weekly | 398 |
| CONSTRUCTION | All_weekly | 749 |
| CONSTRUCTION | M_weekly | 751 |
| CONSTRUCTION | F_weekly | 704 |
| First-line supervisors of construction trades and extraction workers | All_weekly | 1040 |
| First-line supervisors of construction trades and extraction workers | M_weekly | 1047 |
| Brickmasons, blockmasons, and stonemasons | All_weekly | 652 |
| Brickmasons, blockmasons, and stonemasons | M_weekly | 652 |
| Carpenters | All_weekly | 687 |
| Carpenters | M_weekly | 687 |
| Carpet, floor, and tile installers and finishers | All_weekly | 637 |
| Carpet, floor, and tile installers and finishers | M_weekly | 634 |
| Construction laborers | All_weekly | 639 |
| Construction laborers | M_weekly | 642 |
| Operating engineers and other construction equipment operators | All_weekly | 856 |
| Operating engineers and other construction equipment operators | M_weekly | 859 |
| Drywall installers, ceiling tile installers, and tapers | All_weekly | 596 |
| Drywall installers, ceiling tile installers, and tapers | M_weekly | 595 |
| Electricians | All_weekly | 888 |
| Electricians | M_weekly | 891 |
| Painters, construction and maintenance | All_weekly | 585 |
| Painters, construction and maintenance | M_weekly | 587 |
| Pipelayers, plumbers, pipefitters, and steamfitters | All_weekly | 863 |
| Pipelayers, plumbers, pipefitters, and steamfitters | M_weekly | 862 |
| Roofers | All_weekly | 584 |
| Roofers | M_weekly | 580 |
| Sheet metal workers | All_weekly | 766 |
| Sheet metal workers | M_weekly | 776 |
| Structural iron and steel workers | All_weekly | 869 |
| Structural iron and steel workers | M_weekly | 864 |
| Construction and building inspectors | All_weekly | 939 |
| Construction and building inspectors | M_weekly | 965 |
| Highway maintenance workers | All_weekly | 754 |
| Highway maintenance workers | M_weekly | 755 |
| Mining machine operators | All_weekly | 1106 |
| Mining machine operators | M_weekly | 1098 |
| Other extraction workers | All_weekly | 900 |
| Other extraction workers | M_weekly | 918 |
| MAINTENANCE | All_weekly | 839 |
| MAINTENANCE | M_weekly | 842 |
| MAINTENANCE | F_weekly | 761 |
| First-line supervisors of mechanics, installers, and repairers | All_weekly | 1032 |
| First-line supervisors of mechanics, installers, and repairers | M_weekly | 1033 |
| Computer, automated teller, and office machine repairers | All_weekly | 856 |
| Computer, automated teller, and office machine repairers | M_weekly | 865 |
| Radio and telecommunications equipment installers and repairers | All_weekly | 862 |
| Radio and telecommunications equipment installers and repairers | M_weekly | 879 |
| Security and fire alarm systems installers | All_weekly | 911 |
| Security and fire alarm systems installers | M_weekly | 913 |
| Aircraft mechanics and service technicians | All_weekly | 1025 |
| Aircraft mechanics and service technicians | M_weekly | 1032 |
| Automotive body and related repairers | All_weekly | 846 |
| Automotive body and related repairers | M_weekly | 849 |
| Automotive service technicians and mechanics | All_weekly | 722 |
| Automotive service technicians and mechanics | M_weekly | 724 |
| Bus and truck mechanics and diesel engine specialists | All_weekly | 831 |
| Bus and truck mechanics and diesel engine specialists | M_weekly | 830 |
| Heavy vehicle and mobile equipment service technicians and mechanics | All_weekly | 928 |
| Heavy vehicle and mobile equipment service technicians and mechanics | M_weekly | 928 |
| Miscellaneous vehicle and mobile equipment mechanics, installers, and repairers | All_weekly | 592 |
| Miscellaneous vehicle and mobile equipment mechanics, installers, and repairers | M_weekly | 591 |
| Heating, air conditioning, and refrigeration mechanics and installers | All_weekly | 806 |
| Heating, air conditioning, and refrigeration mechanics and installers | M_weekly | 810 |
| Industrial and refractory machinery mechanics | All_weekly | 895 |
| Industrial and refractory machinery mechanics | M_weekly | 894 |
| Maintenance and repair workers, general | All_weekly | 773 |
| Maintenance and repair workers, general | M_weekly | 771 |
| Electrical power-line installers and repairers | All_weekly | 1105 |
| Electrical power-line installers and repairers | M_weekly | 1105 |
| Telecommunications line installers and repairers | All_weekly | 882 |
| Telecommunications line installers and repairers | M_weekly | 880 |
| Precision instrument and equipment repairers | All_weekly | 996 |
| Precision instrument and equipment repairers | M_weekly | 1009 |
| Other installation, maintenance, and repair workers | All_weekly | 792 |
| Other installation, maintenance, and repair workers | M_weekly | 810 |
| PRODUCTION | All_weekly | 663 |
| PRODUCTION | M_weekly | 729 |
| PRODUCTION | F_weekly | 519 |
| First-line supervisors of production and operating workers | All_weekly | 875 |
| First-line supervisors of production and operating workers | M_weekly | 924 |
| First-line supervisors of production and operating workers | F_weekly | 623 |
| Electrical, electronics, and electromechanical assemblers | All_weekly | 554 |
| Electrical, electronics, and electromechanical assemblers | M_weekly | 566 |
| Electrical, electronics, and electromechanical assemblers | F_weekly | 544 |
| Miscellaneous assemblers and fabricators | All_weekly | 581 |
| Miscellaneous assemblers and fabricators | M_weekly | 637 |
| Miscellaneous assemblers and fabricators | F_weekly | 512 |
| Bakers | All_weekly | 505 |
| Bakers | M_weekly | 570 |
| Bakers | F_weekly | 475 |
| Butchers and other meat, poultry, and fish processing workers | All_weekly | 542 |
| Butchers and other meat, poultry, and fish processing workers | M_weekly | 582 |
| Butchers and other meat, poultry, and fish processing workers | F_weekly | 463 |
| Food batchmakers | All_weekly | 500 |
| Food batchmakers | F_weekly | 489 |
| Food processing workers, all other | All_weekly | 594 |
| Food processing workers, all other | M_weekly | 679 |
| Food processing workers, all other | F_weekly | 508 |
| Computer control programmers and operators | All_weekly | 833 |
| Computer control programmers and operators | M_weekly | 857 |
| Cutting, punching, and press machine setters, operators, and tenders, metal and plastic | All_weekly | 633 |
| Cutting, punching, and press machine setters, operators, and tenders, metal and plastic | M_weekly | 674 |
| Machinists | All_weekly | 834 |
| Machinists | M_weekly | 840 |
| Welding, soldering, and brazing workers | All_weekly | 760 |
| Welding, soldering, and brazing workers | M_weekly | 767 |
| Metal workers and plastic workers, all other | All_weekly | 639 |
| Metal workers and plastic workers, all other | M_weekly | 678 |
| Metal workers and plastic workers, all other | F_weekly | 581 |
| Printing press operators | All_weekly | 707 |
| Printing press operators | M_weekly | 729 |
| Laundry and dry-cleaning workers | All_weekly | 466 |
| Laundry and dry-cleaning workers | M_weekly | 487 |
| Laundry and dry-cleaning workers | F_weekly | 460 |
| Sewing machine operators | All_weekly | 493 |
| Sewing machine operators | F_weekly | 476 |
| Stationary engineers and boiler operators | All_weekly | 996 |
| Stationary engineers and boiler operators | M_weekly | 1012 |
| Water and wastewater treatment plant and system operators | All_weekly | 880 |
| Water and wastewater treatment plant and system operators | M_weekly | 868 |
| Chemical processing machine setters, operators, and tenders | All_weekly | 1052 |
| Chemical processing machine setters, operators, and tenders | M_weekly | 1082 |
| Crushing, grinding, polishing, mixing, and blending workers | All_weekly | 652 |
| Crushing, grinding, polishing, mixing, and blending workers | M_weekly | 668 |
| Cutting workers | All_weekly | 685 |
| Inspectors, testers, sorters, samplers, and weighers | All_weekly | 710 |
| Inspectors, testers, sorters, samplers, and weighers | M_weekly | 844 |
| Inspectors, testers, sorters, samplers, and weighers | F_weekly | 583 |
| Medical, dental, and ophthalmic laboratory technicians | All_weekly | 648 |
| Packaging and filling machine operators and tenders | All_weekly | 518 |
| Packaging and filling machine operators and tenders | M_weekly | 605 |
| Packaging and filling machine operators and tenders | F_weekly | 482 |
| Painting workers | All_weekly | 708 |
| Painting workers | M_weekly | 733 |
| Production workers, all other | All_weekly | 625 |
| Production workers, all other | M_weekly | 666 |
| Production workers, all other | F_weekly | 501 |
| TRANSPORTATION | All_weekly | 646 |
| TRANSPORTATION | M_weekly | 679 |
| TRANSPORTATION | F_weekly | 494 |
| Supervisors of transportation and material moving workers | All_weekly | 894 |
| Supervisors of transportation and material moving workers | M_weekly | 898 |
| Aircraft pilots and flight engineers | All_weekly | 1735 |
| Aircraft pilots and flight engineers | M_weekly | 1830 |
| Flight attendants | All_weekly | 846 |
| Bus drivers | All_weekly | 615 |
| Bus drivers | M_weekly | 681 |
| Bus drivers | F_weekly | 572 |
| Driver/sales workers and truck drivers | All_weekly | 747 |
| Driver/sales workers and truck drivers | M_weekly | 751 |
| Driver/sales workers and truck drivers | F_weekly | 632 |
| Taxi drivers and chauffeurs | All_weekly | 585 |
| Taxi drivers and chauffeurs | M_weekly | 600 |
| Railroad conductors and yardmasters | All_weekly | 1117 |
| Railroad conductors and yardmasters | M_weekly | 1137 |
| Parking lot attendants | All_weekly | 492 |
| Automotive and watercraft service attendants | All_weekly | 452 |
| Automotive and watercraft service attendants | M_weekly | 470 |
| Crane and tower operators | All_weekly | 988 |
| Crane and tower operators | M_weekly | 1016 |
| Industrial truck and tractor operators | All_weekly | 609 |
| Industrial truck and tractor operators | M_weekly | 612 |
| Cleaners of vehicles and equipment | All_weekly | 485 |
| Cleaners of vehicles and equipment | M_weekly | 498 |
| Laborers and freight, stock, and material movers, hand | All_weekly | 526 |
| Laborers and freight, stock, and material movers, hand | M_weekly | 547 |
| Laborers and freight, stock, and material movers, hand | F_weekly | 455 |
| Packers and packagers, hand | All_weekly | 438 |
| Packers and packagers, hand | M_weekly | 462 |
| Packers and packagers, hand | F_weekly | 424 |
| Refuse and recyclable material collectors | All_weekly | 501 |
| Refuse and recyclable material collectors | M_weekly | 496 |
Create a simple bar chart
First we will focus on a simple bar chart that shows the weekly salaries for male and females from all professions. In ggplot2 we can use two functions to create bar charts: geom_bar() and geom_col(). Here we will be using geom_col() because it will allow us to map bar size to one of our variables (salary). geom_bar() is best used when you are creating bar charts that visualize frequency.
To create a simple bar chart using geom_col() we need to do the following:
Filter the data that corresponds to all professions using the
filter()function to select only the data that corresponds to rows withALL OCCUPATIONSdata.Begin our chart by using
ggplot()function and designating the dataframe we want to visualizeLay on the first layer by first adding the
+symbol and calling on thegeom_col()function which create a bar chart.In
geom_col()we must define which columns from our dataframe will be along the x axis and y axis using theaes()function.
#1
allOcc <- weeklyData %>%
filter(Occupation == "ALL OCCUPATIONS")
ggplot(allOcc) + #2
geom_col(aes(x = salaryCat, y = salary)) #3 & 4Now that we have our first simple bar chart we can layer on various components to make this graph more visually appealing. The first thing that comes to mind is to order the bars according to salary. We do this by adding the reorder() command to the x value in aes().
Then to add color to each category we can use the fill attribute AFTER aes(). We can choose colors by defining a character vector with specific color values for each category fill = c("magenta", "lightgreen", "lightblue").
ggplot(allOcc) +
geom_col(aes(x = reorder(salaryCat, salary), y = salary), fill = c("magenta", "lightgreen", "lightblue"))To change the labels for each category so that they are more readable to viewers we can add the next layer using scale_x_discrete(labels = "Female", "ALL", "Male")). NOTE: between each layer always include the + symbol.
ggplot(allOcc) +
geom_col(aes(x = reorder(salaryCat, salary), y = salary), fill = c("magenta", "lightgreen", "lightblue")) +
scale_x_discrete(labels=c("Female", "ALL", "Male")) To change the x and y titles, as well as the title of the chart we can add another layer using labs() and center it in theme(). To change the x and y titles, as well as the title of the chart we can add another layer using labs() and center it in theme() by setting the plot.title attribute and element_text() function to adjust the position using hjust to the middle which corresponds to 0.5 (for half of the plot width). Also in theme we can change the background by setting the panel.background attribute and setting the rectangular panel using element_rect to a color using fill. I chose the color black here because I like the contrast on bright colors on a dark background
ggplot(allOcc) +
geom_col(aes(x = reorder(salaryCat, salary), y = salary), fill = c("magenta", "lightgreen", "lightblue")) +
scale_x_discrete(labels=c("Female", "ALL", "Male")) +
labs(y = "Gender", x ="Salary", title = "Mean Weekly Salary for US Professionals") +
theme(plot.title = element_text(hjust = 0.5), panel.background = element_rect(fill = "black"))For the viewers’ convenience I would like to include the value of the salary on top of each bar. To do this we layer on the geom_text function which will add text to the plot. To place the text on top of each bar the x value needs to correspond to the category of salary, the y value should be a little below the bar therefore I used salary - 20, the actual text should correspond to the value of salary which we define using label
ggplot(allOcc) +
geom_col(aes(x = reorder(salaryCat, salary), y = salary), fill = c("magenta", "lightgreen", "lightblue")) +
scale_x_discrete(labels=c("Female", "ALL", "Male")) +
labs(y = "Gender", x ="Salary", title = "Mean Weekly Salary for US Professionals") +
theme(plot.title = element_text(hjust = 0.5), panel.background = element_rect(fill = "black")) +
geom_text(aes(x = salaryCat, y = salary - 20, label = salary))As we can see here now it is totally obveous that males have a higher mean salary than females in the United States. In addition, the mean salary for males also exceed the mean salary for all genders.
Create a grouped bar chart
Now lets say we want to go more into detail about these salaries. We can easily visualize the salaries for each category by created a The weekly salary data is grouped in categories therefore a bar chart will be appropriate to visualize and compare the salaries in the different groups. To do this we complete the following steps:
1. Filter Data:
Filter weekly salary for males and females using
filter()from theweeklyDatadataframeConver from long format to wide using
spread()Drop any rows that contain
NAvalues (those are not comparable) usingdrop_na()Convert back to long format using
pivot_longer()
2. Graph Data:
Begin chart by using
ggplot()First layer using
geom_col()for bar chartIn
geom_col()define columns for x axis, y axis and color parameter using theaes()
Note: The big change here is that we are defining fill inside of aes() and setting it equal to the salaryCat column which identifies the group each salary belongs to (male or female)
Set the colors for male and female bard manually using
scale_fill_manual()Flip the graph so that the bars grow horizontally using
coord_flip()Change the position of the legend using
theme(legend.position = "top")
#1
femaleMale <- weeklyData %>%
filter(salaryCat == "F_weekly" | salaryCat == "M_weekly") %>%
spread(salaryCat, salary) %>%
drop_na() %>%
pivot_longer(F_weekly:M_weekly, names_to = "salaryCat", values_to = "salary")
ggplot(femaleMale) +
geom_col(aes(x = reorder(Occupation,salary), y = salary, fill = salaryCat),
position = "dodge") +
scale_fill_manual(values=c("magenta", "lightblue"))+
coord_flip() +
theme(legend.position = "top")As we can see from the plot above, the data seems very bunched up and messy. This is not visually appealing or easily interpret able. What we can do instead is filter the occupations by salary and choose only the top 10 highest salary occupations to analyze.
1. Filter the data
Convert to wide format using
spread()Filter rows where the column for male weekly salaries exceed $1500
Convert back to long format using
pivot_longer()Select the top 10 occupations (first 20 rows)
2. Graph Data:
Begin chart by using
ggplot()First layer using
geom_col()for bar chart.In
geom_col()define columns for x axis, y axis and color parameter using theaes()Set the colors for male and female bard manually using
scale_fill_manual()Flip the graph so that the bars grow horizontally using
coord_flip()Label x and y axis and title using
labs()Change the position of the title and the legend using
theme()
#1
femaleMale <- femaleMale %>%
spread(salaryCat, salary) %>%
filter(M_weekly >1500) %>%
pivot_longer(F_weekly:M_weekly, names_to = "salaryCat", values_to = "salary")
femaleMaleHigh <- femaleMale[1:20,]
#2
ggplot(femaleMaleHigh) +
geom_col(aes(x = reorder(Occupation,salary), y = salary, fill = salaryCat), position = "dodge") +
scale_fill_manual(values=c("magenta", "lightblue"))+
coord_flip() +
labs(y = "Salary (USD)", x ="Occupation", title = "Top 10 Mean Weekly Salary for US Professionals") +
theme(plot.title = element_text(hjust = 0.5), legend.position = "top") We can clearly see the discrepancies between male and female salaries for the top 10 highest paying jobs. In addition to the salaries it would also be interesting to use ggplot2 to visualize the number of males and females in these jobs.
A Different Take On the Data (Grouped Bar Charts)
# create a new dataframe with number of workers and convert to long format
workerData <- rawData %>%
select(Occupation, M_workers, F_workers)%>%
pivot_longer(M_workers:F_workers, names_to = "Gender", values_to = "Workers") %>%
drop_na()
# Select only the rows that match with the top 10 paying jobs
workerData <- workerData %>% filter(Occupation == femaleMaleHigh$Occupation[1] | Occupation == femaleMaleHigh$Occupation[3] | Occupation == femaleMaleHigh$Occupation[5] | Occupation == femaleMaleHigh$Occupation[7] |Occupation == femaleMaleHigh$Occupation[9]|Occupation == femaleMaleHigh$Occupation[11]|Occupation == femaleMaleHigh$Occupation[13]|Occupation == femaleMaleHigh$Occupation[15]|Occupation == femaleMaleHigh$Occupation[17]|Occupation == femaleMaleHigh$Occupation[19])
#display using kable
kable(workerData)%>%
kable_styling() %>%
scroll_box(width = "100%", height = "200px")| Occupation | Gender | Workers |
|---|---|---|
| Chief executives | M_workers | 763 |
| Chief executives | F_workers | 283 |
| Computer and information systems managers | M_workers | 466 |
| Computer and information systems managers | F_workers | 169 |
| Financial managers | M_workers | 551 |
| Financial managers | F_workers | 573 |
| Education administrators | M_workers | 282 |
| Education administrators | F_workers | 496 |
| Financial analysts | M_workers | 168 |
| Financial analysts | F_workers | 127 |
| COMPUTATIONAL | M_workers | 3036 |
| COMPUTATIONAL | F_workers | 973 |
| Computer programmers | M_workers | 357 |
| Computer programmers | F_workers | 93 |
| Engineers, all other | M_workers | 339 |
| Engineers, all other | F_workers | 54 |
| LEGAL | M_workers | 624 |
| LEGAL | F_workers | 722 |
| Lawyers | M_workers | 503 |
| Lawyers | F_workers | 300 |
# Using the same method of plotting as above section (grouped bar charts)
ggplot(workerData) +
geom_col(aes(x = reorder(Occupation,Workers), y = Workers, fill = Gender), position = "dodge") +
scale_fill_manual(values=c("magenta", "lightblue"))+
coord_flip() +
labs(y = "Number of Workers", x ="Occupation", title = "Number of Workers for the Top 10 Paying Jobs") +
theme(plot.title = element_text(hjust = 0.5), legend.position = "top") Not surprisingly there is a HUGE difference in the number males and females in fields designated as COMPUTATIONAL. Through this visualization, it is easy to provide evidence for the gender divide, unequal pay and gender bias in high paying jobs.
IV Extend: Further Customizations of Bar Charts
Stacked Bars
In the previous sections we wrangled the data into it’s simplest form and configured the plot until it was in a nice readable format. It left us with the question: “Are there any other options we can explore to simplify the graph further?”
Instead of using side by side bars lets consider using stacked bars with differing colors to compare classes.
- We used the fill argument of geom_bar, to indicate what feature will be the classifier
- Next, we used the coord_flip function to improve readability by listing vertically all the occupations
- Finally, instead of using labs, we used the xlab function since we only wanted to slap a label on the side of the graph. As a bonus, xlab(“Occupation”) is much more readable and easier to maintain as well
ggplot(workerData) +
geom_bar(aes(reorder(x = Occupation, Workers), y = Workers, fill = Gender), stat = "identity") +
coord_flip() + xlab("Occupation")Overlay Bars
Stacking the bars pushed the scale further and can be a bit confusing when trying to discern the amounts of each particular bar. We can overlay bars in order to preserve the original scale.
- By using the position argument we can completely separate the bars by using the value dodge, identity will do the opposite byputting them one directly on top of the other
- Instead we can partially overlay the bars using the value position_dodge(.25), this let’s us specify to have the bars “dodge” each other by only 25% of each others proportion
ggplot(workerData) +
geom_bar(aes(reorder(x = Occupation, Workers),
y = Workers, fill = Gender), stat = "identity", position = position_dodge(.25)) +
coord_flip() + xlab("Occupation")Full Circle
By reserving more of the plot’s real estate and scale, we can now try to fit the plot back to the original horizontal position, which was a problem earlier in the presentation.
- We start by removing the coord_flip() function to return the plot to it’s original horizontal position
- Using theme we specify the axis.text.x attribute, which says to specifically manipulate x-axis only
- We then use the element_text function to specify manipulating the text, and pass angle = 45 so that the labels can be anchored 45 degrees
ggplot(workerData) +
geom_bar(aes(reorder(x = Occupation, Workers),
y = Workers, fill = Gender), stat = "identity", position = position_dodge(.25)) +
xlab("Occupation") + theme(axis.text.x = element_text(angle = 45))The plot above still has some problems. For one the labels are in the actual plot and the sort order is now incorrect when in the horizontal position. Let’s fix these problems while also adding some extra features.
- We added to aes the alpha attribute and set the transparency level, so we can see the relationships of the bars even better
- Using the theme function we removed the most of the grid lines by using the panel.grid.major attribute and setting the value to element_blank()
- To adjust the axis labels lower we add hjust = 1 and re-sorted to descending by removing the - sign from Workers in the the reorder function
- For fun we set the panel.background with element_rect() attribute, and use the same color of the sidebar of the presentation with the fill attribute
- Lastly, using scale_fill_manual we set the colors to a nice sky blue against electric pink to make it pop against the deep black red background
ggplot(workerData) +
geom_bar(aes(reorder(x = Occupation, -Workers),
y = Workers, fill = Gender), alpha = .75, stat = "identity", position = position_dodge(.45)) +
xlab("Occupation") +
theme(panel.grid.major = element_blank(),
panel.background = element_rect(fill = '#211103', colour = 'black'),
axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_fill_manual("Gender", values = c("#f62681", "#88c6ed"))Conclusion
We came a long way from the beginning to the end, and what I liked most about the final product is that beyond observing the practical ways we could create the bar plot for presentation and readability, we were able to further customize our visualization to make it exciting and fun.