1. Using the 173 majors listed in fivethirtyeight.com College Majors data set [https://fivethirtyeight.com/features/the-economic-guide-to-picking-a-college-major/], provide code that identifies the majors that contain either “DATA” or “STATISTICS”

Loading the data

url <- "https://github.com/fivethirtyeight/data/blob/master/college-majors/recent-grads.csv?raw=true"
college_majors <- read.csv(url)
college_majors <- read.csv(url)
college_majors
##     Rank Major_code
## 1      1       2419
## 2      2       2416
## 3      3       2415
## 4      4       2417
## 5      5       2405
## 6      6       2418
## 7      7       6202
## 8      8       5001
## 9      9       2414
## 10    10       2408
## 11    11       2407
## 12    12       2401
## 13    13       2404
## 14    14       5008
## 15    15       2409
## 16    16       2402
## 17    17       2412
## 18    18       2400
## 19    19       2403
## 20    20       3201
## 21    21       2102
## 22    22       1104
## 23    23       2502
## 24    24       2413
## 25    25       6212
## 26    26       2406
## 27    27       5601
## 28    28       6204
## 29    29       2499
## 30    30       5402
## 31    31       2410
## 32    32       2500
## 33    33       6099
## 34    34       2411
## 35    35       6107
## 36    36       6207
## 37    37       5501
## 38    38       6205
## 39    39       2503
## 40    40       5102
## 41    41       6201
## 42    42       3700
## 43    43       2100
## 44    44       5007
## 45    45       6105
## 46    46       2105
## 47    47       3702
## 48    48       3701
## 49    49       3607
## 50    50       5006
## 51    51       2501
## 52    52       6104
## 53    53       4005
## 54    54       2101
## 55    55       4006
## 56    56       2303
## 57    57       5505
## 58    58       6200
## 59    59       1401
## 60    60       6210
## 61    61       6108
## 62    62       3603
## 63    63       6299
## 64    64       1101
## 65    65       1100
## 66    66       2599
## 67    67       2504
## 68    68       3605
## 69    69       5599
## 70    70       6403
## 71    71       5205
## 72    72       1102
## 73    73       5000
## 74    74       3801
## 75    75       5003
## 76    76       5701
## 77    77       6203
## 78    78       6206
## 79    79       5506
## 80    80       5504
## 81    81       3606
## 82    82       2106
## 83    83       3601
## 84    84       3602
## 85    85       2107
## 86    86       5004
## 87    87       6209
## 88    88       3202
## 89    89       6199
## 90    90       5401
## 91    91       5005
## 92    92       5206
## 93    93       1301
## 94    94       1901
## 95    95       5301
## 96    96       6004
## 97    97       1902
## 98    98       5098
## 99    99       1904
## 100  100       1501
## 101  101       2310
## 102  102       3608
## 103  103       5503
## 104  104       4002
## 105  105       6103
## 106  106       2001
## 107  107       5901
## 108  108       1303
## 109  109       3611
## 110  110       4000
## 111  111       5002
## 112  112       1302
## 113  113       1106
## 114  114       2300
## 115  115       6402
## 116  116       2602
## 117  117       4001
## 118  118       2311
## 119  119       6110
## 120  120       2305
## 121  121       2301
## 122  122       6106
## 123  123       3699
## 124  124       3600
## 125  125       5507
## 126  126       1903
## 127  127       6109
## 128  128       6211
## 129  129       2313
## 130  130       2601
## 131  131       2399
## 132  132       4007
## 133  133       3604
## 134  134       2309
## 135  135       6100
## 136  136       4801
## 137  137       2314
## 138  138       3301
## 139  139       2304
## 140  140       4101
## 141  141       3401
## 142  142       6005
## 143  143       5500
## 144  144       1105
## 145  145       2308
## 146  146       5200
## 147  147       6002
## 148  148       2306
## 149  149       6006
## 150  150       6000
## 151  151       2901
## 152  152       5404
## 153  153       1103
## 154  154       6003
## 155  155       2312
## 156  156       5299
## 157  157       5403
## 158  158       3402
## 159  159       4901
## 160  160       6007
## 161  161       2201
## 162  162       1199
## 163  163       5502
## 164  164       6102
## 165  165       2307
## 166  166       2603
## 167  167       6001
## 168  168       3302
## 169  169       3609
## 170  170       5201
## 171  171       5202
## 172  172       5203
## 173  173       3501
##                                                                 Major  Total
## 1                                               PETROLEUM ENGINEERING   2339
## 2                                      MINING AND MINERAL ENGINEERING    756
## 3                                           METALLURGICAL ENGINEERING    856
## 4                           NAVAL ARCHITECTURE AND MARINE ENGINEERING   1258
## 5                                                CHEMICAL ENGINEERING  32260
## 6                                                 NUCLEAR ENGINEERING   2573
## 7                                                   ACTUARIAL SCIENCE   3777
## 8                                          ASTRONOMY AND ASTROPHYSICS   1792
## 9                                              MECHANICAL ENGINEERING  91227
## 10                                             ELECTRICAL ENGINEERING  81527
## 11                                               COMPUTER ENGINEERING  41542
## 12                                              AEROSPACE ENGINEERING  15058
## 13                                             BIOMEDICAL ENGINEERING  14955
## 14                                                  MATERIALS SCIENCE   4279
## 15                          ENGINEERING MECHANICS PHYSICS AND SCIENCE   4321
## 16                                             BIOLOGICAL ENGINEERING   8925
## 17                           INDUSTRIAL AND MANUFACTURING ENGINEERING  18968
## 18                                                GENERAL ENGINEERING  61152
## 19                                          ARCHITECTURAL ENGINEERING   2825
## 20                                                    COURT REPORTING   1148
## 21                                                   COMPUTER SCIENCE 128319
## 22                                                       FOOD SCIENCE     NA
## 23                                  ELECTRICAL ENGINEERING TECHNOLOGY  11565
## 24                        MATERIALS ENGINEERING AND MATERIALS SCIENCE   2993
## 25                      MANAGEMENT INFORMATION SYSTEMS AND STATISTICS  18713
## 26                                                  CIVIL ENGINEERING  53153
## 27                                              CONSTRUCTION SERVICES  18498
## 28                                OPERATIONS LOGISTICS AND E-COMMERCE  11732
## 29                                          MISCELLANEOUS ENGINEERING   9133
## 30                                                      PUBLIC POLICY   5978
## 31                                          ENVIRONMENTAL ENGINEERING   4047
## 32                                           ENGINEERING TECHNOLOGIES   3600
## 33                                            MISCELLANEOUS FINE ARTS   3340
## 34                             GEOLOGICAL AND GEOPHYSICAL ENGINEERING    720
## 35                                                            NURSING 209394
## 36                                                            FINANCE 174506
## 37                                                          ECONOMICS 139247
## 38                                                 BUSINESS ECONOMICS  13302
## 39                                 INDUSTRIAL PRODUCTION TECHNOLOGIES   4631
## 40         NUCLEAR, INDUSTRIAL RADIOLOGY, AND BIOLOGICAL TECHNOLOGIES   2116
## 41                                                         ACCOUNTING 198633
## 42                                                        MATHEMATICS  72397
## 43                                   COMPUTER AND INFORMATION SYSTEMS  36698
## 44                                                            PHYSICS  32142
## 45                                   MEDICAL TECHNOLOGIES TECHNICIANS  15914
## 46                                               INFORMATION SCIENCES  11913
## 47                                    STATISTICS AND DECISION SCIENCE   6251
## 48                                                APPLIED MATHEMATICS   4939
## 49                                                       PHARMACOLOGY   1762
## 50                                                       OCEANOGRAPHY   2418
## 51                              ENGINEERING AND INDUSTRIAL MANAGEMENT   2906
## 52                                         MEDICAL ASSISTING SERVICES  11123
## 53                                   MATHEMATICS AND COMPUTER SCIENCE    609
## 54                           COMPUTER PROGRAMMING AND DATA PROCESSING   4168
## 55                                COGNITIVE SCIENCE AND BIOPSYCHOLOGY   3831
## 56                                          SCHOOL STUDENT COUNSELING    818
## 57                                            INTERNATIONAL RELATIONS  28187
## 58                                                   GENERAL BUSINESS 234590
## 59                                                       ARCHITECTURE  46420
## 60                                             INTERNATIONAL BUSINESS  25894
## 61                PHARMACY PHARMACEUTICAL SCIENCES AND ADMINISTRATION  23551
## 62                                                  MOLECULAR BIOLOGY  18300
## 63                    MISCELLANEOUS BUSINESS & MEDICAL ADMINISTRATION  17947
## 64                              AGRICULTURE PRODUCTION AND MANAGEMENT  14240
## 65                                                GENERAL AGRICULTURE  10399
## 66                             MISCELLANEOUS ENGINEERING TECHNOLOGIES   8804
## 67                        MECHANICAL ENGINEERING RELATED TECHNOLOGIES   4790
## 68                                                           GENETICS   3635
## 69                                      MISCELLANEOUS SOCIAL SCIENCES   3283
## 70                                              UNITED STATES HISTORY   3079
## 71                           INDUSTRIAL AND ORGANIZATIONAL PSYCHOLOGY   3014
## 72                                             AGRICULTURAL ECONOMICS   2439
## 73                                                  PHYSICAL SCIENCES   1436
## 74                                              MILITARY TECHNOLOGIES    124
## 75                                                          CHEMISTRY  66530
## 76  ELECTRICAL, MECHANICAL, AND PRECISION TECHNOLOGIES AND PRODUCTION   2435
## 77                             BUSINESS MANAGEMENT AND ADMINISTRATION 329927
## 78                                   MARKETING AND MARKETING RESEARCH 205211
## 79                                   POLITICAL SCIENCE AND GOVERNMENT 182621
## 80                                                          GEOGRAPHY  18480
## 81                                                       MICROBIOLOGY  15232
## 82                    COMPUTER ADMINISTRATION MANAGEMENT AND SECURITY   8066
## 83                                               BIOCHEMICAL SCIENCES  39107
## 84                                                             BOTANY   1329
## 85                         COMPUTER NETWORKING AND TELECOMMUNICATIONS   7613
## 86                                          GEOLOGY AND EARTH SCIENCE  10972
## 87                           HUMAN RESOURCES AND PERSONNEL MANAGEMENT  24497
## 88                                          PRE-LAW AND LEGAL STUDIES  13528
## 89                           MISCELLANEOUS HEALTH MEDICAL PROFESSIONS  13386
## 90                                              PUBLIC ADMINISTRATION   5629
## 91                                                        GEOSCIENCES   1978
## 92                                                  SOCIAL PSYCHOLOGY   1386
## 93                                              ENVIRONMENTAL SCIENCE  25965
## 94                                                     COMMUNICATIONS 213996
## 95                               CRIMINAL JUSTICE AND FIRE PROTECTION 152824
## 96                                  COMMERCIAL ART AND GRAPHIC DESIGN 103480
## 97                                                         JOURNALISM  72619
## 98                              MULTI-DISCIPLINARY OR GENERAL SCIENCE  62052
## 99                                   ADVERTISING AND PUBLIC RELATIONS  53162
## 100                              AREA ETHNIC AND CIVILIZATION STUDIES  31195
## 101                                           SPECIAL NEEDS EDUCATION  28739
## 102                                                        PHYSIOLOGY  22060
## 103                                                       CRIMINOLOGY  19879
## 104                                                NUTRITION SCIENCES  18909
## 105                        HEALTH AND MEDICAL ADMINISTRATIVE SERVICES  18109
## 106                                        COMMUNICATION TECHNOLOGIES  18035
## 107                          TRANSPORTATION SCIENCES AND TECHNOLOGIES  15150
## 108                                      NATURAL RESOURCES MANAGEMENT  13773
## 109                                                      NEUROSCIENCE  13663
## 110                                   MULTI/INTERDISCIPLINARY STUDIES  12296
## 111                              ATMOSPHERIC SCIENCES AND METEOROLOGY   4043
## 112                                                          FORESTRY   3607
## 113                                                      SOIL SCIENCE    685
## 114                                                 GENERAL EDUCATION 143718
## 115                                                           HISTORY 141951
## 116     FRENCH GERMAN LATIN AND OTHER COMMON FOREIGN LANGUAGE STUDIES  48246
## 117                           INTERCULTURAL AND INTERNATIONAL STUDIES  24650
## 118                       SOCIAL SCIENCE OR HISTORY TEACHER EDUCATION  20198
## 119                                       COMMUNITY AND PUBLIC HEALTH  19735
## 120                                     MATHEMATICS TEACHER EDUCATION  14237
## 121                        EDUCATIONAL ADMINISTRATION AND SUPERVISION    804
## 122                           HEALTH AND MEDICAL PREPARATORY PROGRAMS  12740
## 123                                             MISCELLANEOUS BIOLOGY  10706
## 124                                                           BIOLOGY 280709
## 125                                                         SOCIOLOGY 115433
## 126                                                        MASS MEDIA  52824
## 127                                     TREATMENT THERAPY PROFESSIONS  48491
## 128                                            HOSPITALITY MANAGEMENT  43647
## 129                                      LANGUAGE AND DRAMA EDUCATION  30471
## 130               LINGUISTICS AND COMPARATIVE LANGUAGE AND LITERATURE  16601
## 131                                           MISCELLANEOUS EDUCATION  10150
## 132                                 INTERDISCIPLINARY SOCIAL SCIENCES   9916
## 133                                                           ECOLOGY   9154
## 134                                       SECONDARY TEACHER EDUCATION  17125
## 135                               GENERAL MEDICAL AND HEALTH SERVICES  33599
## 136                                  PHILOSOPHY AND RELIGIOUS STUDIES  54814
## 137                                           ART AND MUSIC EDUCATION  34181
## 138                                   ENGLISH LANGUAGE AND LITERATURE 194673
## 139                                              ELEMENTARY EDUCATION 170862
## 140                     PHYSICAL FITNESS PARKS RECREATION AND LEISURE 125074
## 141                                                      LIBERAL ARTS  71369
## 142                                  FILM VIDEO AND PHOTOGRAPHIC ARTS  38761
## 143                                           GENERAL SOCIAL SCIENCES  12920
## 144                                        PLANT SCIENCE AND AGRONOMY   7416
## 145                            SCIENCE AND COMPUTER TEACHER EDUCATION   6483
## 146                                                        PSYCHOLOGY 393735
## 147                                                             MUSIC  60633
## 148                            PHYSICAL AND HEALTH EDUCATION TEACHING  28213
## 149                                         ART HISTORY AND CRITICISM  21030
## 150                                                         FINE ARTS  74440
## 151                                      FAMILY AND CONSUMER SCIENCES  58001
## 152                                                       SOCIAL WORK  53552
## 153                                                   ANIMAL SCIENCES  21573
## 154                                        VISUAL AND PERFORMING ARTS  16250
## 155                                TEACHER EDUCATION: MULTIPLE LEVELS  14443
## 156                                          MISCELLANEOUS PSYCHOLOGY   9628
## 157                         HUMAN SERVICES AND COMMUNITY ORGANIZATION   9374
## 158                                                        HUMANITIES   6652
## 159                                  THEOLOGY AND RELIGIOUS VOCATIONS  30207
## 160                                                       STUDIO ARTS  16977
## 161                            COSMETOLOGY SERVICES AND CULINARY ARTS  10510
## 162                                         MISCELLANEOUS AGRICULTURE   1488
## 163                                       ANTHROPOLOGY AND ARCHEOLOGY  38844
## 164                     COMMUNICATION DISORDERS SCIENCES AND SERVICES  38279
## 165                                         EARLY CHILDHOOD EDUCATION  37589
## 166                                           OTHER FOREIGN LANGUAGES  11204
## 167                                            DRAMA AND THEATER ARTS  43249
## 168                                          COMPOSITION AND RHETORIC  18953
## 169                                                           ZOOLOGY   8409
## 170                                            EDUCATIONAL PSYCHOLOGY   2854
## 171                                               CLINICAL PSYCHOLOGY   2838
## 172                                             COUNSELING PSYCHOLOGY   4626
## 173                                                   LIBRARY SCIENCE   1098
##        Men  Women                      Major_category ShareWomen Sample_size
## 1     2057    282                         Engineering 0.12056434          36
## 2      679     77                         Engineering 0.10185185           7
## 3      725    131                         Engineering 0.15303738           3
## 4     1123    135                         Engineering 0.10731320          16
## 5    21239  11021                         Engineering 0.34163050         289
## 6     2200    373                         Engineering 0.14496697          17
## 7     2110   1667                            Business 0.44135557          51
## 8      832    960                   Physical Sciences 0.53571429          10
## 9    80320  10907                         Engineering 0.11955890        1029
## 10   65511  16016                         Engineering 0.19645026         631
## 11   33258   8284                         Engineering 0.19941264         399
## 12   12953   2105                         Engineering 0.13979280         147
## 13    8407   6548                         Engineering 0.43784687          79
## 14    2949   1330                         Engineering 0.31082028          22
## 15    3526    795                         Engineering 0.18398519          30
## 16    6062   2863                         Engineering 0.32078431          55
## 17   12453   6515                         Engineering 0.34347322         183
## 18   45683  15469                         Engineering 0.25295984         425
## 19    1835    990                         Engineering 0.35044248          26
## 20     877    271                 Law & Public Policy 0.23606272          14
## 21   99743  28576             Computers & Mathematics 0.22269500        1196
## 22      NA     NA     Agriculture & Natural Resources         NA          36
## 23    8181   3384                         Engineering 0.29260700          97
## 24    2020    973                         Engineering 0.32509188          22
## 25   13496   5217                            Business 0.27879015         278
## 26   41081  12072                         Engineering 0.22711794         565
## 27   16820   1678 Industrial Arts & Consumer Services 0.09071251         295
## 28    7921   3811                            Business 0.32483805         156
## 29    7398   1735                         Engineering 0.18997044         118
## 30    2639   3339                 Law & Public Policy 0.55854801          55
## 31    2662   1385                         Engineering 0.34222881          26
## 32    2695    905                         Engineering 0.25138889          39
## 33    1970   1370                                Arts 0.41017964          30
## 34     488    232                         Engineering 0.32222222           5
## 35   21773 187621                              Health 0.89601899        2554
## 36  115030  59476                            Business 0.34082496        2189
## 37   89749  49498                      Social Science 0.35546906        1322
## 38    7575   5727                            Business 0.43053676         199
## 39    3477   1154                         Engineering 0.24919024          73
## 40     528   1588                   Physical Sciences 0.75047259          31
## 41   94519 104114                            Business 0.52415258        2042
## 42   39956  32441             Computers & Mathematics 0.44809868         541
## 43   27392   9306             Computers & Mathematics 0.25358330         425
## 44   23080   9062                   Physical Sciences 0.28193641         142
## 45    3916  11998                              Health 0.75392736         190
## 46    9005   2908             Computers & Mathematics 0.24410308         158
## 47    2960   3291             Computers & Mathematics 0.52647576          37
## 48    2794   2145             Computers & Mathematics 0.43429844          45
## 49     515   1247              Biology & Life Science 0.70771850           3
## 50     752   1666                   Physical Sciences 0.68899917          36
## 51    2400    506                         Engineering 0.17412251          29
## 52     803  10320                              Health 0.92780725          67
## 53     500    109             Computers & Mathematics 0.17898194           7
## 54    3046   1122             Computers & Mathematics 0.26919386          43
## 55    1667   2164              Biology & Life Science 0.56486557          25
## 56     119    699                           Education 0.85452323           4
## 57   10345  17842                      Social Science 0.63298684         219
## 58  132238 102352                            Business 0.43630163        2380
## 59   25463  20957                         Engineering 0.45146489         362
## 60   10624  15270                            Business 0.58971190         260
## 61    8697  14854                              Health 0.63071632          38
## 62    7426  10874              Biology & Life Science 0.59420765          90
## 63   10285   7662                            Business 0.42692372         244
## 64    9658   4582     Agriculture & Natural Resources 0.32176966         273
## 65    6053   4346     Agriculture & Natural Resources 0.41792480         158
## 66    7043   1761                         Engineering 0.20002272         125
## 67    4419    371                         Engineering 0.07745303          71
## 68    1761   1874              Biology & Life Science 0.51554333          11
## 69    1499   1784                      Social Science 0.54340542          28
## 70    1756   1323           Humanities & Liberal Arts 0.42968496          22
## 71    1075   1939            Psychology & Social Work 0.64333112          24
## 72    1749    690     Agriculture & Natural Resources 0.28290283          44
## 73     894    542                   Physical Sciences 0.37743733          10
## 74     124      0 Industrial Arts & Consumer Services 0.00000000           4
## 75   32923  33607                   Physical Sciences 0.50514054         353
## 76    1869    566 Industrial Arts & Consumer Services 0.23244353          37
## 77  173809 156118                            Business 0.47318952        4212
## 78   78857 126354                            Business 0.61572723        2684
## 79   93880  88741                      Social Science 0.48592988        1387
## 80   11404   7076                      Social Science 0.38290043         179
## 81    6383   8849              Biology & Life Science 0.58094800          62
## 82    6607   1459             Computers & Mathematics 0.18088272         103
## 83   18951  20156              Biology & Life Science 0.51540645         174
## 84     626    703              Biology & Life Science 0.52896915           9
## 85    5291   2322             Computers & Mathematics 0.30500460          97
## 86    5813   5159                   Physical Sciences 0.47019687          78
## 87    6184  18313                            Business 0.74756093         264
## 88    4435   9093                 Law & Public Policy 0.67216144          92
## 89    1589  11797                              Health 0.88129389          81
## 90    2947   2682                 Law & Public Policy 0.47646118          46
## 91     809   1169                   Physical Sciences 0.59100101          18
## 92     413    973            Psychology & Social Work 0.70202020           8
## 93   10787  15178              Biology & Life Science 0.58455613         225
## 94   70619 143377         Communications & Journalism 0.66999851        2394
## 95   80231  72593                 Law & Public Policy 0.47501047        1728
## 96   32041  71439                                Arts 0.69036529        1186
## 97   23736  48883         Communications & Journalism 0.67314339         843
## 98   27015  35037                   Physical Sciences 0.56463933         427
## 99   12862  40300         Communications & Journalism 0.75806027         681
## 100   8739  22456           Humanities & Liberal Arts 0.71985895         249
## 101   2682  26057                           Education 0.90667734         246
## 102   8422  13638              Biology & Life Science 0.61822303          99
## 103  10031   9848                      Social Science 0.49539715         214
## 104   2563  16346                              Health 0.86445608         118
## 105   4266  13843                              Health 0.76442653         184
## 106  11431   6604             Computers & Mathematics 0.36617688         208
## 107  13257   1893 Industrial Arts & Consumer Services 0.12495049         180
## 108   8617   5156     Agriculture & Natural Resources 0.37435562         152
## 109   4944   8719              Biology & Life Science 0.63814682          53
## 110   2817   9479                   Interdisciplinary 0.77090111         128
## 111   2744   1299                   Physical Sciences 0.32129607          32
## 112   3156    451     Agriculture & Natural Resources 0.12503465          48
## 113    476    209     Agriculture & Natural Resources 0.30510949           4
## 114  26893 116825                           Education 0.81287661         919
## 115  78253  63698           Humanities & Liberal Arts 0.44873231        1058
## 116  12835  35411           Humanities & Liberal Arts 0.73396758         342
## 117   8575  16075           Humanities & Liberal Arts 0.65212982         184
## 118   9950  10248                           Education 0.50737697         157
## 119   4103  15632                              Health 0.79209526         130
## 120   3872  10365                           Education 0.72803259         123
## 121    280    524                           Education 0.65174129           5
## 122   5521   7219                              Health 0.56664050          31
## 123   4747   5959              Biology & Life Science 0.55660377          63
## 124 111762 168947              Biology & Life Science 0.60185815        1370
## 125  32510  82923                      Social Science 0.71836477        1024
## 126  24704  28120         Communications & Journalism 0.53233379         590
## 127  13487  35004                              Health 0.72186591         224
## 128  15204  28443                            Business 0.65165991         546
## 129   3741  26730                           Education 0.87722753         235
## 130   4416  12185           Humanities & Liberal Arts 0.73399193          88
## 131   3654   6496                           Education 0.64000000         126
## 132   2337   7579                      Social Science 0.76432029          95
## 133   3878   5276              Biology & Life Science 0.57636006          86
## 134   6820  10305                           Education 0.60175183         156
## 135   7574  26025                              Health 0.77457662         202
## 136  31967  22847           Humanities & Liberal Arts 0.41680957         375
## 137  10732  23449                           Education 0.68602440         338
## 138  58227 136446           Humanities & Liberal Arts 0.70089843        1436
## 139  13029 157833                           Education 0.92374548        1629
## 140  62181  62893 Industrial Arts & Consumer Services 0.50284631        1014
## 141  22339  49030           Humanities & Liberal Arts 0.68699295         569
## 142  22357  16404                                Arts 0.42320890         331
## 143   5079   7841                      Social Science 0.60688855         113
## 144   4897   2519     Agriculture & Natural Resources 0.33967098         110
## 145   2049   4434                           Education 0.68394262          59
## 146  86648 307087            Psychology & Social Work 0.77993320        2584
## 147  29909  30724                                Arts 0.50672076         419
## 148  15670  12543                           Education 0.44458229         259
## 149   3240  17790           Humanities & Liberal Arts 0.84593438         204
## 150  24786  49654                                Arts 0.66703385         623
## 151   5166  52835 Industrial Arts & Consumer Services 0.91093257         518
## 152   5137  48415            Psychology & Social Work 0.90407454         374
## 153   5347  16226     Agriculture & Natural Resources 0.75214388         255
## 154   4133  12117                                Arts 0.74566154         132
## 155   2734  11709                           Education 0.81070415         142
## 156   1936   7692            Psychology & Social Work 0.79891982          60
## 157    885   8489            Psychology & Social Work 0.90558993          89
## 158   2013   4639           Humanities & Liberal Arts 0.69738424          49
## 159  18616  11591           Humanities & Liberal Arts 0.38371901         310
## 160   4754  12223                                Arts 0.71997408         182
## 161   4364   6146 Industrial Arts & Consumer Services 0.58477640         117
## 162    404   1084     Agriculture & Natural Resources 0.72849462          24
## 163  11376  27468           Humanities & Liberal Arts 0.70713624         247
## 164   1225  37054                              Health 0.96799812          95
## 165   1167  36422                           Education 0.96895368         342
## 166   3472   7732           Humanities & Liberal Arts 0.69011068          56
## 167  14440  28809                                Arts 0.66611945         357
## 168   7022  11931           Humanities & Liberal Arts 0.62950456         151
## 169   3050   5359              Biology & Life Science 0.63729338          47
## 170    522   2332            Psychology & Social Work 0.81709881           7
## 171    568   2270            Psychology & Social Work 0.79985906          13
## 172    931   3695            Psychology & Social Work 0.79874622          21
## 173    134    964                           Education 0.87795993           2
##     Employed Full_time Part_time Full_time_year_round Unemployed
## 1       1976      1849       270                 1207         37
## 2        640       556       170                  388         85
## 3        648       558       133                  340         16
## 4        758      1069       150                  692         40
## 5      25694     23170      5180                16697       1672
## 6       1857      2038       264                 1449        400
## 7       2912      2924       296                 2482        308
## 8       1526      1085       553                  827         33
## 9      76442     71298     13101                54639       4650
## 10     61928     55450     12695                41413       3895
## 11     32506     30315      5146                23621       2275
## 12     11391     11106      2724                 8790        794
## 13     10047      9017      2694                 5986       1019
## 14      3307      2751       878                 1967         78
## 15      3608      2999       811                 2004         23
## 16      6170      5455      1983                 3413        589
## 17     15604     14879      2243                11326        699
## 18     44931     41235      7199                33540       2859
## 19      2575      2277       343                 1848        170
## 20       930       808       223                  808         11
## 21    102087     91485     18726                70932       6884
## 22      3149      2558      1121                 1735        338
## 23      8587      7530      1873                 5681        824
## 24      2449      1658      1040                 1151         70
## 25     16413     15141      2420                13017       1015
## 26     43041     38302     10080                29196       3270
## 27     16318     15690      1751                12313       1042
## 28     10027      9639      1183                 7724        504
## 29      7428      6811      1662                 5476        597
## 30      4547      4163      1306                 2776        670
## 31      2983      2384       930                 1951        308
## 32      2799      2257       689                 1723        163
## 33      2914      2049      1067                 1200        286
## 34       604       524       126                  396         49
## 35    180903    151191     40818               122817       8497
## 36    145696    137921     21463               108595       9413
## 37    104117     96567     25325                70740      11452
## 38     10914     10048      1937                 8000       1165
## 39      4428      3988       597                 3242        129
## 40      1778      1392       579                 1115        137
## 41    165527    151967     27693               123169      12411
## 42     58118     46399     18079                33738       2884
## 43     28459     26348      4332                21130       2934
## 44     25302     19428      8721                14389       1282
## 45     13150     11510      2665                 9005        505
## 46      9881      9105      1468                 7378        639
## 47      4247      3190      1840                 2151        401
## 48      3854      3465      1176                 2593        385
## 49      1144       657       532                  565        107
## 50      1638      1931       379                 1595         99
## 51      2125      1992       462                 1358         74
## 52      9168      5643      4107                 4290        407
## 53       559       584         0                  391          0
## 54      3257      3204       482                 2453        419
## 55      2741      2470       711                 1584        223
## 56       730       595       135                  545         88
## 57     21190     18681      5563                13583       2271
## 58    190183    171385     36241               138299      14946
## 59     34158     29223     10206                20026       4366
## 60     19660     17563      4890                12823       2092
## 61     16620     12537      5346                 9131        977
## 62     11581      9441      4590                 6183       1067
## 63     14826     13364      3366                10637       1150
## 64     12323     11119      2196                 9093        649
## 65      8884      7589      2031                 5888        178
## 66      7502      7001      1240                 5825        416
## 67      4186      4175       247                 3607        250
## 68      2463      1787       847                 1487         87
## 69      2727      2183       907                 1530        215
## 70      2787      2103       839                 1274        138
## 71      2343      1644      1095                 1409        286
## 72      2174      1819       620                 1528        182
## 73      1146       768       437                  653         42
## 74         0       111         0                  111          0
## 75     48535     39509     15066                29910       2769
## 76      2107      2057       287                 1752         64
## 77    276234    251540     50357               199897      21502
## 78    178862    156668     35829               127230      11663
## 79    133454    117709     43711                83236      15022
## 80     14057     11367      5651                 8628       1799
## 81      9685      7453      3379                 5080        693
## 82      6509      6289      1030                 4936        721
## 83     25678     20643      9948                13785       2249
## 84      1010       946       169                  740          0
## 85      6144      5495      1447                 4369       1100
## 86      8296      6966      2913                 5008        677
## 87     20760     18550      3767                15446       1315
## 88      9762      7851      3595                 5370        757
## 89     10076      7514      4145                 5868        893
## 90      4158      4148       847                 2952        789
## 91      1441      1264       354                 1011         36
## 92      1080       828       433                  529         33
## 93     20859     16987      7071                10916       1779
## 94    179633    147335     49889               116251      14602
## 95    125393    109970     32242                88548      11268
## 96     83483     67448     24387                52243       8947
## 97     61022     51411     15902                39524       4535
## 98     46138     37850     13133                28966       2727
## 99     45326     38815     10948                30932       3305
## 100    24629     18755      9541                13109       1668
## 101    24639     21584      5153                16642       1067
## 102    14643     10732      6541                 7588       1088
## 103    16181     13616      4543                10548       1743
## 104    13217      9601      6648                 6625        975
## 105    15419     13534      3299                10982       1518
## 106    14779     11981      4690                 9085       2006
## 107    12266     11688      2633                 9170        962
## 108    11797     10722      2613                 6954        842
## 109     9087      8027      3078                 5482        463
## 110     9821      8032      3173                 6234        749
## 111     3431      2659      1309                 2161         78
## 112     3007      2473       891                 1763        322
## 113      613       488       185                  383          0
## 114   118241     98408     29558                73531       7195
## 115   105646     84681     40657                59218      11176
## 116    38315     29340     14569                20056       3132
## 117    18824     14354      7978                 8801       1718
## 118    17700     14002      5168                 8871       1012
## 119    14512     10099      6377                 7460       1833
## 120    13115     11259      2273                 8073        216
## 121      703       733         0                  504          0
## 122     7052      5029      3891                 3236        529
## 123     7767      6076      2568                 4542        483
## 124   182295    144512     72371               100336      13874
## 125    92721     73475     29639                56561       8608
## 126    44679     35769     13078                27521       4410
## 127    37861     30020     12346                21735       2409
## 128    36728     32160      7494                23106       2393
## 129    26033     21419      7239                15266       1379
## 130    11165      8462      4831                 5821       1302
## 131     8691      7264      2202                 5816        547
## 132     7444      5843      2834                 4714        757
## 133     7585      5603      2741                 3912        437
## 134    15116     12520      3782                 9193        833
## 135    24406     18166     11088                12809       2183
## 136    40157     31086     16659                21816       4267
## 137    30007     23018      9209                16537       1206
## 138   149180    114386     57825                81180      14345
## 139   149339    123177     37965                86540       7297
## 140   103078     77428     38515                57978       5593
## 141    54844     43401     19187                33438       4657
## 142    31433     22457     12818                15740       3718
## 143     9602      7700      3396                 5679       1108
## 144     6594      5798      1246                 4522        314
## 145     5362      4764      1227                 3247        266
## 146   307933    233205    115172               174438      28169
## 147    47662     29010     24943                21425       3918
## 148    23794     19420      7230                13651       1920
## 149    17579     13262      6140                 9965       1128
## 150    59679     42764     23656                31877       5486
## 151    46624     36747     15872                26906       3355
## 152    45038     34941     13481                27588       3329
## 153    17112     14479      5353                10824        917
## 154    12870      8447      6253                 6322       1465
## 155    13076     11734      2214                 8457        496
## 156     7653      5201      3221                 3838        419
## 157     8294      6455      2405                 5061        326
## 158     5052      3565      2225                 2661        372
## 159    24202     18079      8767                13944       1617
## 160    13908     10451      5673                 7413       1368
## 161     8650      7662      2064                 5949        510
## 162     1290      1098       335                  936         82
## 163    29633     20147     14515                13232       3395
## 164    29763     19975     13862                14460       1487
## 165    32551     27569      7001                20748       1360
## 166     7052      5197      3685                 3214        846
## 167    36165     25147     15994                16891       3040
## 168    15053     10121      6612                 7832       1340
## 169     6259      5043      2190                 3602        304
## 170     2125      1848       572                 1211        148
## 171     2101      1724       648                 1293        368
## 172     3777      3154       965                 2738        214
## 173      742       593       237                  410         87
##     Unemployment_rate Median P25th  P75th College_jobs Non_college_jobs
## 1         0.018380527 110000 95000 125000         1534              364
## 2         0.117241379  75000 55000  90000          350              257
## 3         0.024096386  73000 50000 105000          456              176
## 4         0.050125313  70000 43000  80000          529              102
## 5         0.061097712  65000 50000  75000        18314             4440
## 6         0.177226407  65000 50000 102000         1142              657
## 7         0.095652174  62000 53000  72000         1768              314
## 8         0.021167415  62000 31500 109000          972              500
## 9         0.057342278  60000 48000  70000        52844            16384
## 10        0.059173845  60000 45000  72000        45829            10874
## 11        0.065409275  60000 45000  75000        23694             5721
## 12        0.065162085  60000 42000  70000         8184             2425
## 13        0.092083860  60000 36000  70000         6439             2471
## 14        0.023042836  60000 39000  65000         2626              391
## 15        0.006334343  58000 25000  74000         2439              947
## 16        0.087143069  57100 40000  76000         3603             1595
## 17        0.042875544  57000 37900  67000         8306             3235
## 18        0.059824231  56000 36000  69000        26898            11734
## 19        0.061930783  54000 38000  65000         1665              649
## 20        0.011689692  54000 50000  54000          402              528
## 21        0.063172771  53000 39000  70000        68622            25667
## 22        0.096931460  53000 32000  70000         1183             1274
## 23        0.087557114  52000 35000  60000         5126             2686
## 24        0.027788805  52000 35000  62000         1911              305
## 25        0.058239614  51000 38000  60000         6342             5741
## 26        0.070609574  50000 40000  60000        28526             9356
## 27        0.060023041  50000 36000  60000         3275             5351
## 28        0.047858703  50000 40000  60000         1466             3629
## 29        0.074392523  50000 39000  65000         3445             2426
## 30        0.128426299  50000 35000  70000         1550             1871
## 31        0.093588575  50000 42000  56000         2028              830
## 32        0.055030385  50000 43000  60000         1017             1269
## 33        0.089375000  50000 25000  66000          693             1714
## 34        0.075038285  50000 42800  57000          501               50
## 35        0.044862724  48000 39000  58000       151643            26146
## 36        0.060686356  47000 35000  64000        24243            48447
## 37        0.099092317  47000 35000  65000        25582            37057
## 38        0.096448381  46000 33000  58000         1578             4612
## 39        0.028308097  46000 35000  65000         1394             2454
## 40        0.071540470  46000 38000  53000          162             1475
## 41        0.069749014  45000 34000  56000        11417            39323
## 42        0.047277138  45000 33000  60000        34800            14829
## 43        0.093460326  45000 30000  60000        13344            11783
## 44        0.048224496  45000 30000  68000        18674             4576
## 45        0.036982790  45000 36000  50000         5546             7176
## 46        0.060741445  45000 32500  58000         4390             4102
## 47        0.086273666  45000 26700  60000         2298             1200
## 48        0.090823307  45000 34000  63000         2437              803
## 49        0.085531575  45000 40000  45000          603              478
## 50        0.056994819  44700 23000  50000          459              996
## 51        0.033651660  44000 30000  50000          482              844
## 52        0.042506527  42000 30000  65000         2091             6948
## 53        0.000000000  42000 30000  78000          452               67
## 54        0.113982590  41300 20000  46000         2024             1033
## 55        0.075236167  41000 20000  60000         1369              921
## 56        0.107579462  41000 41000  43000          509              221
## 57        0.096798943  40100 31200  53000         6774             9570
## 58        0.072861468  40000 30000  55000        29334           100831
## 59        0.113331949  40000 31000  50000        16178            13724
## 60        0.096175064  40000 30000  50000         3383             9482
## 61        0.055520827  40000 20000  90000        11573             4493
## 62        0.084361164  40000 29000  47000         7225             3145
## 63        0.071982974  40000 30000  51000         2236             8937
## 64        0.050030836  40000 25000  50000         1925             6221
## 65        0.019642463  40000 30000  50000         2418             4717
## 66        0.052538520  40000 30400  56000         2446             3896
## 67        0.056357078  40000 27000  52000         1861             2121
## 68        0.034117647  40000 34000  45000         1675              678
## 69        0.073079538  40000 30000  54000          744             1654
## 70        0.047179487  40000 30000  42000          801             1591
## 71        0.108786611  40000 32000  53000          559             1224
## 72        0.077249576  40000 27000  54000          535              893
## 73        0.035353535  40000 30000  55000          530              465
## 74        0.000000000  40000 40000  40000            0                0
## 75        0.053972400  39000 30000  49900        30382            14718
## 76        0.029479503  38400 22500  45000          221             1659
## 77        0.072218341  38000 29000  50000        36720           148395
## 78        0.061215064  38000 30000  50000        25320            93889
## 79        0.101174601  38000 28000  50000        36854            66947
## 80        0.113458628  38000 30000  50000         5350             6830
## 81        0.066775872  38000 29600  50000         5577             3174
## 82        0.099723375  37500 25000  50000         2354             3244
## 83        0.080531385  37400 29000  50000        15654             8394
## 84        0.000000000  37000 26000  40000          677              184
## 85        0.151849807  36400 27000  49000         2593             2941
## 86        0.075448568  36200 28000  47000         4858             2792
## 87        0.059569649  36000 28000  45000         2406             9629
## 88        0.071965016  36000 29200  46000         2002             6454
## 89        0.081411250  36000 23000  42000         5652             3835
## 90        0.159490600  36000 23000  60000          919             2313
## 91        0.024373731  36000 21000  41000          784              591
## 92        0.029649596  36000 34000  45000          434              593
## 93        0.078584681  35600 25000  40200         8149            10076
## 94        0.075176976  35000 27000  45000        40763            97964
## 95        0.082452199  35000 26000  45000        24348            88858
## 96        0.096797577  35000 25000  45000        37389            38119
## 97        0.069176442  35000 26000  42900        23279            26672
## 98        0.055806815  35000 24000  50000        17923            22039
## 99        0.067960766  35000 27000  47000         9659            23059
## 100       0.063429289  35000 24500  44000         8465            11818
## 101       0.041507819  35000 32000  42000        20185             3797
## 102       0.069162800  35000 20000  50000         6587             6894
## 103       0.097243919  35000 25000  45000         3373            10605
## 104       0.068700676  35000 26000  45000         6535             5473
## 105       0.089626262  35000 27000  42000         2589             8592
## 106       0.119511469  35000 25000  45000         4545             8794
## 107       0.072724524  35000 22000  52000         4575             6147
## 108       0.066619195  35000 25000  42000         4333             5808
## 109       0.048481675  35000 30000  44000         5605             2301
## 110       0.070860927  35000 25000  44000         5176             3903
## 111       0.022228555  35000 28000  50000         1808             1317
## 112       0.096725743  35000 28600  48000         1096             1692
## 113       0.000000000  35000 18500  44000          355              144
## 114       0.057359929  34000 26000  41000        82007            31112
## 115       0.095666912  34000 25000  47000        35336            54569
## 116       0.075566386  34000 25000  45000        15051            18193
## 117       0.083633531  34000 24000  45000         4956            10343
## 118       0.054082941  34000 23050  42000        10928             5561
## 119       0.112144387  34000 21000  45000         5225             7385
## 120       0.016202835  34000 30000  40000        10699             1977
## 121       0.000000000  34000 29000  35000          346              206
## 122       0.069779712  33500 23000  40000         3051             3539
## 123       0.058545455  33500 23000  48000         4253             2722
## 124       0.070724732  33400 24000  45000        88232            81109
## 125       0.084951001  33000 25000  44000        29051            48899
## 126       0.089836827  33000 25000  45000        12855            25297
## 127       0.059821207  33000 24000  41000        22215            14616
## 128       0.061169193  33000 25000  42000         2325            23341
## 129       0.050306435  33000 24000  40000        17985             6824
## 130       0.104435710  33000 25000  40000         4122             5695
## 131       0.059211951  33000 30000  45000         5284             2438
## 132       0.092305816  33000 24000  40000         2630             3906
## 133       0.054475193  33000 23000  42000         2856             4159
## 134       0.052228980  32500 25000  38000        10304             3967
## 135       0.082101621  32400 25000  45000         9364            12889
## 136       0.096051684  32200 23000  47100        14444            20313
## 137       0.038637747  32100 25000  40000        20821             8260
## 138       0.087723590  32000 23000  41000        57690            71827
## 139       0.046585715  32000 23400  38000       108085            36972
## 140       0.051467273  32000 24000  43000        27581            63946
## 141       0.078267592  32000 25000  42000        18565            28558
## 142       0.105772240  32000 22000  42000         7368            20721
## 143       0.103454715  32000 27000  50000         3602             4778
## 144       0.045454545  32000 22900  40000         2089             3545
## 145       0.047263682  32000 28000  39000         4214             1106
## 146       0.083810867  31500 24000  41000       125148           141860
## 147       0.075959674  31000 22300  42000        13752            28786
## 148       0.074667496  31000 24000  40000        12777             9328
## 149       0.060298284  31000 23000  40000         5139             9738
## 150       0.084186296  30500 21000  41000        20792            32725
## 151       0.067128194  30000 22900  40000        20985            20133
## 152       0.068827920  30000 25000  35000        27449            14416
## 153       0.050862499  30000 22000  40000         5443             9571
## 154       0.102197419  30000 22000  40000         3849             7635
## 155       0.036545830  30000 24000  37000        10766             1949
## 156       0.051907830  30000 20800  40000         2960             3948
## 157       0.037819026  30000 24000  35000         2878             4595
## 158       0.068584071  30000 20000  49000         1168             3354
## 159       0.062628297  29000 22000  38000         9927            12037
## 160       0.089552239  29000 19200  38300         3948             8707
## 161       0.055676856  29000 20000  36000          563             7384
## 162       0.059766764  29000 23000  42100          483              626
## 163       0.102791571  28000 20000  38000         9805            16693
## 164       0.047584000  28000 20000  40000        19957             9404
## 165       0.040104981  28000 21000  35000        23515             7705
## 166       0.107115726  27500 22900  38000         2326             3703
## 167       0.077541130  27000 19200  35000         6994            25313
## 168       0.081742207  27000 20000  35000         4855             8100
## 169       0.046320280  26000 20000  39000         2771             2947
## 170       0.065112187  25000 24000  34000         1488              615
## 171       0.149048198  25000 25000  40000          986              870
## 172       0.053620646  23400 19200  26000         2403             1245
## 173       0.104945718  22000 20000  22000          288              338
##     Low_wage_jobs
## 1             193
## 2              50
## 3               0
## 4               0
## 5             972
## 6             244
## 7             259
## 8             220
## 9            3253
## 10           3170
## 11            980
## 12            372
## 13            789
## 14             81
## 15            263
## 16            524
## 17            640
## 18           3192
## 19            137
## 20            144
## 21           5144
## 22            485
## 23            696
## 24             70
## 25            708
## 26           2899
## 27            703
## 28            285
## 29            365
## 30            340
## 31            260
## 32            142
## 33            755
## 34             49
## 35           6193
## 36           9910
## 37          10653
## 38           1284
## 39            480
## 40            124
## 41          10886
## 42           4569
## 43           1672
## 44           1823
## 45           1002
## 46            608
## 47            343
## 48            357
## 49             93
## 50            186
## 51            245
## 52           1270
## 53             25
## 54            263
## 55            135
## 56              0
## 57           2499
## 58          27320
## 59           4221
## 60           3046
## 61           1121
## 62           1168
## 63           1758
## 64           1362
## 65            839
## 66            386
## 67            406
## 68            201
## 69            573
## 70            302
## 71            272
## 72             94
## 73            269
## 74              0
## 75           4288
## 76             81
## 77          32395
## 78          27968
## 79          19803
## 80           1905
## 81           1246
## 82            308
## 83           3012
## 84             56
## 85            352
## 86            959
## 87           1906
## 88           1336
## 89           1422
## 90            496
## 91            221
## 92             37
## 93           3175
## 94          27440
## 95          18404
## 96          14839
## 97           8512
## 98           5751
## 99           7214
## 100          3677
## 101          1179
## 102          2237
## 103          1895
## 104          2449
## 105          1391
## 106          2495
## 107           557
## 108          1405
## 109           902
## 110          1061
## 111           237
## 112           327
## 113             0
## 114         11443
## 115         16839
## 116          5267
## 117          3168
## 118          1806
## 119          1854
## 120           786
## 121           111
## 122          1159
## 123           459
## 124         28339
## 125         13748
## 126          6429
## 127          4468
## 128          9063
## 129          2819
## 130          2085
## 131           657
## 132          1470
## 133           976
## 134          1385
## 135          3816
## 136          8051
## 137          2767
## 138         26503
## 139         11502
## 140         16838
## 141          9030
## 142          5862
## 143          1634
## 144          1231
## 145           591
## 146         48207
## 147          9286
## 148          2042
## 149          3426
## 150         11880
## 151          5248
## 152          4344
## 153          2125
## 154          2840
## 155           722
## 156          1650
## 157           724
## 158          1141
## 159          3304
## 160          3586
## 161          3163
## 162            31
## 163          6866
## 164          5125
## 165          2868
## 166          1115
## 167         11068
## 168          3466
## 169           743
## 170            82
## 171           622
## 172           308
## 173           192

Finding majors containing “DATA” OR “STATISTICS”

library(stringr)

college_majors <- read.csv(url)
matching_majors <- str_detect(college_majors, pattern = "DATA | STATISTICS")
## Warning in stri_detect_regex(string, pattern, negate = negate, opts_regex =
## opts(pattern)): argument is not an atomic vector; coercing
print(matching_majors)
##  [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
str_subset(college_majors$Major, pattern = "DATA | STATISTICS")
## [1] "MANAGEMENT INFORMATION SYSTEMS AND STATISTICS"
## [2] "COMPUTER PROGRAMMING AND DATA PROCESSING"

2. Write code that transforms the data

original vector

fruits <- c("bell pepper", "bilberry",  "blackberry", "blood orange", "blueberry", "cantaloupe", "chili pepper", "cloudberry", "elderberry", "lime", "lychee", "mulberry", "olive", "salal berry")

Transformed vector

fruits_new <- c(fruits)
print(fruits_new)
##  [1] "bell pepper"  "bilberry"     "blackberry"   "blood orange" "blueberry"   
##  [6] "cantaloupe"   "chili pepper" "cloudberry"   "elderberry"   "lime"        
## [11] "lychee"       "mulberry"     "olive"        "salal berry"

3. Describe, in words, what these expressions will match:

(.)\1\1 will match a string containing three consecutive identical characters. For example, it would match “eee” or “333.”

“(.)(.)\2\1” will match a string that consists of two pairs of identical characters separated by a space. For example,it would match “i i,” “7 7,” or “y y,” where the same character is repeated in each pair and separated by a space.

(..)\1 will match a string containing two consecutive pairs of identical characters. For example, it would match “eeff” or “7799” .

“(.).\1.\1” will match a string that starts with three groups of characters separated by spaces, followed by any number of other characters, and ends with the characters from the three groups in reverse order. For example, it would match “a b c 123 cba” or “x y z 456 zyx,” where the first three groups of characters are followed by any number of other characters and then followed by the same characters in reverse order.

“(.)(.)(.).*\3\2\1” This regular expression is the same as“(.).\1.\1” but without the escaped backslashes. It will also match strings that starts with three groups of characters separated by spaces, followed by any number of other characters, and ends with the characters from the three groups in reverse order

#4 Construct regular expressions to match words that:

Start and end with the same character:

str_view("level", "\\b(\\w)(\\w*)\\1\\b")
## [1] │ <level>

Contain a repeated pair of letters (e.g. “church” contains “ch” repeated twice.)

str_view("church", "\\b\\w*(\\w{2})\\w*\\1\\w*\\b")
## [1] │ <church>

Contain one letter repeated in at least three places (e.g.”eleven” contains three “e”s.)

str_view("Mississippi", "\\b(\\w*([a-zA-Z])\\w*\\2\\w*\\2\\w*)\\b"
)
## [1] │ <Mississippi>

`