#install.packages("tidyverse")
#install.packages("DBI")
#install.packages("odbc")
#install.packages("RSQLite")
#install.packages("dblyr")
#install.packages("RMySQL")
library(DBI)
library(odbc)
library(RSQLite)
library(dbplyr)
library(RMySQL)
##
## Attaching package: 'RMySQL'
## The following object is masked from 'package:RSQLite':
##
## isIdCurrent
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::ident() masks dbplyr::ident()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::sql() masks dbplyr::sql()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidyverse, quietly=TRUE)
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
major_data <- read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/college-majors/majors-list.csv")
major_data
## FOD1P Major
## 1 1100 GENERAL AGRICULTURE
## 2 1101 AGRICULTURE PRODUCTION AND MANAGEMENT
## 3 1102 AGRICULTURAL ECONOMICS
## 4 1103 ANIMAL SCIENCES
## 5 1104 FOOD SCIENCE
## 6 1105 PLANT SCIENCE AND AGRONOMY
## 7 1106 SOIL SCIENCE
## 8 1199 MISCELLANEOUS AGRICULTURE
## 9 1302 FORESTRY
## 10 1303 NATURAL RESOURCES MANAGEMENT
## 11 6000 FINE ARTS
## 12 6001 DRAMA AND THEATER ARTS
## 13 6002 MUSIC
## 14 6003 VISUAL AND PERFORMING ARTS
## 15 6004 COMMERCIAL ART AND GRAPHIC DESIGN
## 16 6005 FILM VIDEO AND PHOTOGRAPHIC ARTS
## 17 6007 STUDIO ARTS
## 18 6099 MISCELLANEOUS FINE ARTS
## 19 1301 ENVIRONMENTAL SCIENCE
## 20 3600 BIOLOGY
## 21 3601 BIOCHEMICAL SCIENCES
## 22 3602 BOTANY
## 23 3603 MOLECULAR BIOLOGY
## 24 3604 ECOLOGY
## 25 3605 GENETICS
## 26 3606 MICROBIOLOGY
## 27 3607 PHARMACOLOGY
## 28 3608 PHYSIOLOGY
## 29 3609 ZOOLOGY
## 30 3611 NEUROSCIENCE
## 31 3699 MISCELLANEOUS BIOLOGY
## 32 4006 COGNITIVE SCIENCE AND BIOPSYCHOLOGY
## 33 6200 GENERAL BUSINESS
## 34 6201 ACCOUNTING
## 35 6202 ACTUARIAL SCIENCE
## 36 6203 BUSINESS MANAGEMENT AND ADMINISTRATION
## 37 6204 OPERATIONS LOGISTICS AND E-COMMERCE
## 38 6205 BUSINESS ECONOMICS
## 39 6206 MARKETING AND MARKETING RESEARCH
## 40 6207 FINANCE
## 41 6209 HUMAN RESOURCES AND PERSONNEL MANAGEMENT
## 42 6210 INTERNATIONAL BUSINESS
## 43 6211 HOSPITALITY MANAGEMENT
## 44 6212 MANAGEMENT INFORMATION SYSTEMS AND STATISTICS
## 45 6299 MISCELLANEOUS BUSINESS & MEDICAL ADMINISTRATION
## 46 1901 COMMUNICATIONS
## 47 1902 JOURNALISM
## 48 1903 MASS MEDIA
## 49 1904 ADVERTISING AND PUBLIC RELATIONS
## 50 2001 COMMUNICATION TECHNOLOGIES
## 51 2100 COMPUTER AND INFORMATION SYSTEMS
## 52 2101 COMPUTER PROGRAMMING AND DATA PROCESSING
## 53 2102 COMPUTER SCIENCE
## 54 2105 INFORMATION SCIENCES
## 55 2106 COMPUTER ADMINISTRATION MANAGEMENT AND SECURITY
## 56 2107 COMPUTER NETWORKING AND TELECOMMUNICATIONS
## 57 3700 MATHEMATICS
## 58 3701 APPLIED MATHEMATICS
## 59 3702 STATISTICS AND DECISION SCIENCE
## 60 4005 MATHEMATICS AND COMPUTER SCIENCE
## 61 2300 GENERAL EDUCATION
## 62 2301 EDUCATIONAL ADMINISTRATION AND SUPERVISION
## 63 2303 SCHOOL STUDENT COUNSELING
## 64 2304 ELEMENTARY EDUCATION
## 65 2305 MATHEMATICS TEACHER EDUCATION
## 66 2306 PHYSICAL AND HEALTH EDUCATION TEACHING
## 67 2307 EARLY CHILDHOOD EDUCATION
## 68 2308 SCIENCE AND COMPUTER TEACHER EDUCATION
## 69 2309 SECONDARY TEACHER EDUCATION
## 70 2310 SPECIAL NEEDS EDUCATION
## 71 2311 SOCIAL SCIENCE OR HISTORY TEACHER EDUCATION
## 72 2312 TEACHER EDUCATION: MULTIPLE LEVELS
## 73 2313 LANGUAGE AND DRAMA EDUCATION
## 74 2314 ART AND MUSIC EDUCATION
## 75 2399 MISCELLANEOUS EDUCATION
## 76 3501 LIBRARY SCIENCE
## 77 1401 ARCHITECTURE
## 78 2400 GENERAL ENGINEERING
## 79 2401 AEROSPACE ENGINEERING
## 80 2402 BIOLOGICAL ENGINEERING
## 81 2403 ARCHITECTURAL ENGINEERING
## 82 2404 BIOMEDICAL ENGINEERING
## 83 2405 CHEMICAL ENGINEERING
## 84 2406 CIVIL ENGINEERING
## 85 2407 COMPUTER ENGINEERING
## 86 2408 ELECTRICAL ENGINEERING
## 87 2409 ENGINEERING MECHANICS PHYSICS AND SCIENCE
## 88 2410 ENVIRONMENTAL ENGINEERING
## 89 2411 GEOLOGICAL AND GEOPHYSICAL ENGINEERING
## 90 2412 INDUSTRIAL AND MANUFACTURING ENGINEERING
## 91 2413 MATERIALS ENGINEERING AND MATERIALS SCIENCE
## 92 2414 MECHANICAL ENGINEERING
## 93 2415 METALLURGICAL ENGINEERING
## 94 2416 MINING AND MINERAL ENGINEERING
## 95 2417 NAVAL ARCHITECTURE AND MARINE ENGINEERING
## 96 2418 NUCLEAR ENGINEERING
## 97 2419 PETROLEUM ENGINEERING
## 98 2499 MISCELLANEOUS ENGINEERING
## 99 2500 ENGINEERING TECHNOLOGIES
## 100 2501 ENGINEERING AND INDUSTRIAL MANAGEMENT
## 101 2502 ELECTRICAL ENGINEERING TECHNOLOGY
## 102 2503 INDUSTRIAL PRODUCTION TECHNOLOGIES
## 103 2504 MECHANICAL ENGINEERING RELATED TECHNOLOGIES
## 104 2599 MISCELLANEOUS ENGINEERING TECHNOLOGIES
## 105 5008 MATERIALS SCIENCE
## 106 4002 NUTRITION SCIENCES
## 107 6100 GENERAL MEDICAL AND HEALTH SERVICES
## 108 6102 COMMUNICATION DISORDERS SCIENCES AND SERVICES
## 109 6103 HEALTH AND MEDICAL ADMINISTRATIVE SERVICES
## 110 6104 MEDICAL ASSISTING SERVICES
## 111 6105 MEDICAL TECHNOLOGIES TECHNICIANS
## 112 6106 HEALTH AND MEDICAL PREPARATORY PROGRAMS
## 113 6107 NURSING
## 114 6108 PHARMACY PHARMACEUTICAL SCIENCES AND ADMINISTRATION
## 115 6109 TREATMENT THERAPY PROFESSIONS
## 116 6110 COMMUNITY AND PUBLIC HEALTH
## 117 6199 MISCELLANEOUS HEALTH MEDICAL PROFESSIONS
## 118 1501 AREA ETHNIC AND CIVILIZATION STUDIES
## 119 2601 LINGUISTICS AND COMPARATIVE LANGUAGE AND LITERATURE
## 120 2602 FRENCH GERMAN LATIN AND OTHER COMMON FOREIGN LANGUAGE STUDIES
## 121 2603 OTHER FOREIGN LANGUAGES
## 122 3301 ENGLISH LANGUAGE AND LITERATURE
## 123 3302 COMPOSITION AND RHETORIC
## 124 3401 LIBERAL ARTS
## 125 3402 HUMANITIES
## 126 4001 INTERCULTURAL AND INTERNATIONAL STUDIES
## 127 4801 PHILOSOPHY AND RELIGIOUS STUDIES
## 128 4901 THEOLOGY AND RELIGIOUS VOCATIONS
## 129 5502 ANTHROPOLOGY AND ARCHEOLOGY
## 130 6006 ART HISTORY AND CRITICISM
## 131 6402 HISTORY
## 132 6403 UNITED STATES HISTORY
## 133 2201 COSMETOLOGY SERVICES AND CULINARY ARTS
## 134 2901 FAMILY AND CONSUMER SCIENCES
## 135 3801 MILITARY TECHNOLOGIES
## 136 4101 PHYSICAL FITNESS PARKS RECREATION AND LEISURE
## 137 5601 CONSTRUCTION SERVICES
## 138 5701 ELECTRICAL, MECHANICAL, AND PRECISION TECHNOLOGIES AND PRODUCTION
## 139 5901 TRANSPORTATION SCIENCES AND TECHNOLOGIES
## 140 4000 MULTI/INTERDISCIPLINARY STUDIES
## 141 3201 COURT REPORTING
## 142 3202 PRE-LAW AND LEGAL STUDIES
## 143 5301 CRIMINAL JUSTICE AND FIRE PROTECTION
## 144 5401 PUBLIC ADMINISTRATION
## 145 5402 PUBLIC POLICY
## 146 bbbb N/A (less than bachelor's degree)
## 147 5000 PHYSICAL SCIENCES
## 148 5001 ASTRONOMY AND ASTROPHYSICS
## 149 5002 ATMOSPHERIC SCIENCES AND METEOROLOGY
## 150 5003 CHEMISTRY
## 151 5004 GEOLOGY AND EARTH SCIENCE
## 152 5005 GEOSCIENCES
## 153 5006 OCEANOGRAPHY
## 154 5007 PHYSICS
## 155 5098 MULTI-DISCIPLINARY OR GENERAL SCIENCE
## 156 5102 NUCLEAR, INDUSTRIAL RADIOLOGY, AND BIOLOGICAL TECHNOLOGIES
## 157 5200 PSYCHOLOGY
## 158 5201 EDUCATIONAL PSYCHOLOGY
## 159 5202 CLINICAL PSYCHOLOGY
## 160 5203 COUNSELING PSYCHOLOGY
## 161 5205 INDUSTRIAL AND ORGANIZATIONAL PSYCHOLOGY
## 162 5206 SOCIAL PSYCHOLOGY
## 163 5299 MISCELLANEOUS PSYCHOLOGY
## 164 5403 HUMAN SERVICES AND COMMUNITY ORGANIZATION
## 165 5404 SOCIAL WORK
## 166 4007 INTERDISCIPLINARY SOCIAL SCIENCES
## 167 5500 GENERAL SOCIAL SCIENCES
## 168 5501 ECONOMICS
## 169 5503 CRIMINOLOGY
## 170 5504 GEOGRAPHY
## 171 5505 INTERNATIONAL RELATIONS
## 172 5506 POLITICAL SCIENCE AND GOVERNMENT
## 173 5507 SOCIOLOGY
## 174 5599 MISCELLANEOUS SOCIAL SCIENCES
## Major_Category
## 1 Agriculture & Natural Resources
## 2 Agriculture & Natural Resources
## 3 Agriculture & Natural Resources
## 4 Agriculture & Natural Resources
## 5 Agriculture & Natural Resources
## 6 Agriculture & Natural Resources
## 7 Agriculture & Natural Resources
## 8 Agriculture & Natural Resources
## 9 Agriculture & Natural Resources
## 10 Agriculture & Natural Resources
## 11 Arts
## 12 Arts
## 13 Arts
## 14 Arts
## 15 Arts
## 16 Arts
## 17 Arts
## 18 Arts
## 19 Biology & Life Science
## 20 Biology & Life Science
## 21 Biology & Life Science
## 22 Biology & Life Science
## 23 Biology & Life Science
## 24 Biology & Life Science
## 25 Biology & Life Science
## 26 Biology & Life Science
## 27 Biology & Life Science
## 28 Biology & Life Science
## 29 Biology & Life Science
## 30 Biology & Life Science
## 31 Biology & Life Science
## 32 Biology & Life Science
## 33 Business
## 34 Business
## 35 Business
## 36 Business
## 37 Business
## 38 Business
## 39 Business
## 40 Business
## 41 Business
## 42 Business
## 43 Business
## 44 Business
## 45 Business
## 46 Communications & Journalism
## 47 Communications & Journalism
## 48 Communications & Journalism
## 49 Communications & Journalism
## 50 Computers & Mathematics
## 51 Computers & Mathematics
## 52 Computers & Mathematics
## 53 Computers & Mathematics
## 54 Computers & Mathematics
## 55 Computers & Mathematics
## 56 Computers & Mathematics
## 57 Computers & Mathematics
## 58 Computers & Mathematics
## 59 Computers & Mathematics
## 60 Computers & Mathematics
## 61 Education
## 62 Education
## 63 Education
## 64 Education
## 65 Education
## 66 Education
## 67 Education
## 68 Education
## 69 Education
## 70 Education
## 71 Education
## 72 Education
## 73 Education
## 74 Education
## 75 Education
## 76 Education
## 77 Engineering
## 78 Engineering
## 79 Engineering
## 80 Engineering
## 81 Engineering
## 82 Engineering
## 83 Engineering
## 84 Engineering
## 85 Engineering
## 86 Engineering
## 87 Engineering
## 88 Engineering
## 89 Engineering
## 90 Engineering
## 91 Engineering
## 92 Engineering
## 93 Engineering
## 94 Engineering
## 95 Engineering
## 96 Engineering
## 97 Engineering
## 98 Engineering
## 99 Engineering
## 100 Engineering
## 101 Engineering
## 102 Engineering
## 103 Engineering
## 104 Engineering
## 105 Engineering
## 106 Health
## 107 Health
## 108 Health
## 109 Health
## 110 Health
## 111 Health
## 112 Health
## 113 Health
## 114 Health
## 115 Health
## 116 Health
## 117 Health
## 118 Humanities & Liberal Arts
## 119 Humanities & Liberal Arts
## 120 Humanities & Liberal Arts
## 121 Humanities & Liberal Arts
## 122 Humanities & Liberal Arts
## 123 Humanities & Liberal Arts
## 124 Humanities & Liberal Arts
## 125 Humanities & Liberal Arts
## 126 Humanities & Liberal Arts
## 127 Humanities & Liberal Arts
## 128 Humanities & Liberal Arts
## 129 Humanities & Liberal Arts
## 130 Humanities & Liberal Arts
## 131 Humanities & Liberal Arts
## 132 Humanities & Liberal Arts
## 133 Industrial Arts & Consumer Services
## 134 Industrial Arts & Consumer Services
## 135 Industrial Arts & Consumer Services
## 136 Industrial Arts & Consumer Services
## 137 Industrial Arts & Consumer Services
## 138 Industrial Arts & Consumer Services
## 139 Industrial Arts & Consumer Services
## 140 Interdisciplinary
## 141 Law & Public Policy
## 142 Law & Public Policy
## 143 Law & Public Policy
## 144 Law & Public Policy
## 145 Law & Public Policy
## 146 <NA>
## 147 Physical Sciences
## 148 Physical Sciences
## 149 Physical Sciences
## 150 Physical Sciences
## 151 Physical Sciences
## 152 Physical Sciences
## 153 Physical Sciences
## 154 Physical Sciences
## 155 Physical Sciences
## 156 Physical Sciences
## 157 Psychology & Social Work
## 158 Psychology & Social Work
## 159 Psychology & Social Work
## 160 Psychology & Social Work
## 161 Psychology & Social Work
## 162 Psychology & Social Work
## 163 Psychology & Social Work
## 164 Psychology & Social Work
## 165 Psychology & Social Work
## 166 Social Science
## 167 Social Science
## 168 Social Science
## 169 Social Science
## 170 Social Science
## 171 Social Science
## 172 Social Science
## 173 Social Science
## 174 Social Science
data <- read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/college-majors/all-ages.csv")
data
## Major_code
## 1 1100
## 2 1101
## 3 1102
## 4 1103
## 5 1104
## 6 1105
## 7 1106
## 8 1199
## 9 1301
## 10 1302
## 11 1303
## 12 1401
## 13 1501
## 14 1901
## 15 1902
## 16 1903
## 17 1904
## 18 2001
## 19 2100
## 20 2101
## 21 2102
## 22 2105
## 23 2106
## 24 2107
## 25 2201
## 26 2300
## 27 2301
## 28 2303
## 29 2304
## 30 2305
## 31 2306
## 32 2307
## 33 2308
## 34 2309
## 35 2310
## 36 2311
## 37 2312
## 38 2313
## 39 2314
## 40 2399
## 41 2400
## 42 2401
## 43 2402
## 44 2403
## 45 2404
## 46 2405
## 47 2406
## 48 2407
## 49 2408
## 50 2409
## 51 2410
## 52 2411
## 53 2412
## 54 2413
## 55 2414
## 56 2415
## 57 2416
## 58 2417
## 59 2418
## 60 2419
## 61 2499
## 62 2500
## 63 2501
## 64 2502
## 65 2503
## 66 2504
## 67 2599
## 68 2601
## 69 2602
## 70 2603
## 71 2901
## 72 3201
## 73 3202
## 74 3301
## 75 3302
## 76 3401
## 77 3402
## 78 3501
## 79 3600
## 80 3601
## 81 3602
## 82 3603
## 83 3604
## 84 3605
## 85 3606
## 86 3607
## 87 3608
## 88 3609
## 89 3611
## 90 3699
## 91 3700
## 92 3701
## 93 3702
## 94 3801
## 95 4000
## 96 4001
## 97 4002
## 98 4005
## 99 4006
## 100 4007
## 101 4101
## 102 4801
## 103 4901
## 104 5000
## 105 5001
## 106 5002
## 107 5003
## 108 5004
## 109 5005
## 110 5006
## 111 5007
## 112 5008
## 113 5098
## 114 5102
## 115 5200
## 116 5201
## 117 5202
## 118 5203
## 119 5205
## 120 5206
## 121 5299
## 122 5301
## 123 5401
## 124 5402
## 125 5403
## 126 5404
## 127 5500
## 128 5501
## 129 5502
## 130 5503
## 131 5504
## 132 5505
## 133 5506
## 134 5507
## 135 5599
## 136 5601
## 137 5701
## 138 5901
## 139 6000
## 140 6001
## 141 6002
## 142 6003
## 143 6004
## 144 6005
## 145 6006
## 146 6007
## 147 6099
## 148 6100
## 149 6102
## 150 6103
## 151 6104
## 152 6105
## 153 6106
## 154 6107
## 155 6108
## 156 6109
## 157 6110
## 158 6199
## 159 6200
## 160 6201
## 161 6202
## 162 6203
## 163 6204
## 164 6205
## 165 6206
## 166 6207
## 167 6209
## 168 6210
## 169 6211
## 170 6212
## 171 6299
## 172 6402
## 173 6403
## Major
## 1 GENERAL AGRICULTURE
## 2 AGRICULTURE PRODUCTION AND MANAGEMENT
## 3 AGRICULTURAL ECONOMICS
## 4 ANIMAL SCIENCES
## 5 FOOD SCIENCE
## 6 PLANT SCIENCE AND AGRONOMY
## 7 SOIL SCIENCE
## 8 MISCELLANEOUS AGRICULTURE
## 9 ENVIRONMENTAL SCIENCE
## 10 FORESTRY
## 11 NATURAL RESOURCES MANAGEMENT
## 12 ARCHITECTURE
## 13 AREA ETHNIC AND CIVILIZATION STUDIES
## 14 COMMUNICATIONS
## 15 JOURNALISM
## 16 MASS MEDIA
## 17 ADVERTISING AND PUBLIC RELATIONS
## 18 COMMUNICATION TECHNOLOGIES
## 19 COMPUTER AND INFORMATION SYSTEMS
## 20 COMPUTER PROGRAMMING AND DATA PROCESSING
## 21 COMPUTER SCIENCE
## 22 INFORMATION SCIENCES
## 23 COMPUTER ADMINISTRATION MANAGEMENT AND SECURITY
## 24 COMPUTER NETWORKING AND TELECOMMUNICATIONS
## 25 COSMETOLOGY SERVICES AND CULINARY ARTS
## 26 GENERAL EDUCATION
## 27 EDUCATIONAL ADMINISTRATION AND SUPERVISION
## 28 SCHOOL STUDENT COUNSELING
## 29 ELEMENTARY EDUCATION
## 30 MATHEMATICS TEACHER EDUCATION
## 31 PHYSICAL AND HEALTH EDUCATION TEACHING
## 32 EARLY CHILDHOOD EDUCATION
## 33 SCIENCE AND COMPUTER TEACHER EDUCATION
## 34 SECONDARY TEACHER EDUCATION
## 35 SPECIAL NEEDS EDUCATION
## 36 SOCIAL SCIENCE OR HISTORY TEACHER EDUCATION
## 37 TEACHER EDUCATION: MULTIPLE LEVELS
## 38 LANGUAGE AND DRAMA EDUCATION
## 39 ART AND MUSIC EDUCATION
## 40 MISCELLANEOUS EDUCATION
## 41 GENERAL ENGINEERING
## 42 AEROSPACE ENGINEERING
## 43 BIOLOGICAL ENGINEERING
## 44 ARCHITECTURAL ENGINEERING
## 45 BIOMEDICAL ENGINEERING
## 46 CHEMICAL ENGINEERING
## 47 CIVIL ENGINEERING
## 48 COMPUTER ENGINEERING
## 49 ELECTRICAL ENGINEERING
## 50 ENGINEERING MECHANICS PHYSICS AND SCIENCE
## 51 ENVIRONMENTAL ENGINEERING
## 52 GEOLOGICAL AND GEOPHYSICAL ENGINEERING
## 53 INDUSTRIAL AND MANUFACTURING ENGINEERING
## 54 MATERIALS ENGINEERING AND MATERIALS SCIENCE
## 55 MECHANICAL ENGINEERING
## 56 METALLURGICAL ENGINEERING
## 57 MINING AND MINERAL ENGINEERING
## 58 NAVAL ARCHITECTURE AND MARINE ENGINEERING
## 59 NUCLEAR ENGINEERING
## 60 PETROLEUM ENGINEERING
## 61 MISCELLANEOUS ENGINEERING
## 62 ENGINEERING TECHNOLOGIES
## 63 ENGINEERING AND INDUSTRIAL MANAGEMENT
## 64 ELECTRICAL ENGINEERING TECHNOLOGY
## 65 INDUSTRIAL PRODUCTION TECHNOLOGIES
## 66 MECHANICAL ENGINEERING RELATED TECHNOLOGIES
## 67 MISCELLANEOUS ENGINEERING TECHNOLOGIES
## 68 LINGUISTICS AND COMPARATIVE LANGUAGE AND LITERATURE
## 69 FRENCH GERMAN LATIN AND OTHER COMMON FOREIGN LANGUAGE STUDIES
## 70 OTHER FOREIGN LANGUAGES
## 71 FAMILY AND CONSUMER SCIENCES
## 72 COURT REPORTING
## 73 PRE-LAW AND LEGAL STUDIES
## 74 ENGLISH LANGUAGE AND LITERATURE
## 75 COMPOSITION AND RHETORIC
## 76 LIBERAL ARTS
## 77 HUMANITIES
## 78 LIBRARY SCIENCE
## 79 BIOLOGY
## 80 BIOCHEMICAL SCIENCES
## 81 BOTANY
## 82 MOLECULAR BIOLOGY
## 83 ECOLOGY
## 84 GENETICS
## 85 MICROBIOLOGY
## 86 PHARMACOLOGY
## 87 PHYSIOLOGY
## 88 ZOOLOGY
## 89 NEUROSCIENCE
## 90 MISCELLANEOUS BIOLOGY
## 91 MATHEMATICS
## 92 APPLIED MATHEMATICS
## 93 STATISTICS AND DECISION SCIENCE
## 94 MILITARY TECHNOLOGIES
## 95 MULTI/INTERDISCIPLINARY STUDIES
## 96 INTERCULTURAL AND INTERNATIONAL STUDIES
## 97 NUTRITION SCIENCES
## 98 MATHEMATICS AND COMPUTER SCIENCE
## 99 COGNITIVE SCIENCE AND BIOPSYCHOLOGY
## 100 INTERDISCIPLINARY SOCIAL SCIENCES
## 101 PHYSICAL FITNESS PARKS RECREATION AND LEISURE
## 102 PHILOSOPHY AND RELIGIOUS STUDIES
## 103 THEOLOGY AND RELIGIOUS VOCATIONS
## 104 PHYSICAL SCIENCES
## 105 ASTRONOMY AND ASTROPHYSICS
## 106 ATMOSPHERIC SCIENCES AND METEOROLOGY
## 107 CHEMISTRY
## 108 GEOLOGY AND EARTH SCIENCE
## 109 GEOSCIENCES
## 110 OCEANOGRAPHY
## 111 PHYSICS
## 112 MATERIALS SCIENCE
## 113 MULTI-DISCIPLINARY OR GENERAL SCIENCE
## 114 NUCLEAR, INDUSTRIAL RADIOLOGY, AND BIOLOGICAL TECHNOLOGIES
## 115 PSYCHOLOGY
## 116 EDUCATIONAL PSYCHOLOGY
## 117 CLINICAL PSYCHOLOGY
## 118 COUNSELING PSYCHOLOGY
## 119 INDUSTRIAL AND ORGANIZATIONAL PSYCHOLOGY
## 120 SOCIAL PSYCHOLOGY
## 121 MISCELLANEOUS PSYCHOLOGY
## 122 CRIMINAL JUSTICE AND FIRE PROTECTION
## 123 PUBLIC ADMINISTRATION
## 124 PUBLIC POLICY
## 125 HUMAN SERVICES AND COMMUNITY ORGANIZATION
## 126 SOCIAL WORK
## 127 GENERAL SOCIAL SCIENCES
## 128 ECONOMICS
## 129 ANTHROPOLOGY AND ARCHEOLOGY
## 130 CRIMINOLOGY
## 131 GEOGRAPHY
## 132 INTERNATIONAL RELATIONS
## 133 POLITICAL SCIENCE AND GOVERNMENT
## 134 SOCIOLOGY
## 135 MISCELLANEOUS SOCIAL SCIENCES
## 136 CONSTRUCTION SERVICES
## 137 ELECTRICAL, MECHANICAL, AND PRECISION TECHNOLOGIES AND PRODUCTION
## 138 TRANSPORTATION SCIENCES AND TECHNOLOGIES
## 139 FINE ARTS
## 140 DRAMA AND THEATER ARTS
## 141 MUSIC
## 142 VISUAL AND PERFORMING ARTS
## 143 COMMERCIAL ART AND GRAPHIC DESIGN
## 144 FILM VIDEO AND PHOTOGRAPHIC ARTS
## 145 ART HISTORY AND CRITICISM
## 146 STUDIO ARTS
## 147 MISCELLANEOUS FINE ARTS
## 148 GENERAL MEDICAL AND HEALTH SERVICES
## 149 COMMUNICATION DISORDERS SCIENCES AND SERVICES
## 150 HEALTH AND MEDICAL ADMINISTRATIVE SERVICES
## 151 MEDICAL ASSISTING SERVICES
## 152 MEDICAL TECHNOLOGIES TECHNICIANS
## 153 HEALTH AND MEDICAL PREPARATORY PROGRAMS
## 154 NURSING
## 155 PHARMACY PHARMACEUTICAL SCIENCES AND ADMINISTRATION
## 156 TREATMENT THERAPY PROFESSIONS
## 157 COMMUNITY AND PUBLIC HEALTH
## 158 MISCELLANEOUS HEALTH MEDICAL PROFESSIONS
## 159 GENERAL BUSINESS
## 160 ACCOUNTING
## 161 ACTUARIAL SCIENCE
## 162 BUSINESS MANAGEMENT AND ADMINISTRATION
## 163 OPERATIONS LOGISTICS AND E-COMMERCE
## 164 BUSINESS ECONOMICS
## 165 MARKETING AND MARKETING RESEARCH
## 166 FINANCE
## 167 HUMAN RESOURCES AND PERSONNEL MANAGEMENT
## 168 INTERNATIONAL BUSINESS
## 169 HOSPITALITY MANAGEMENT
## 170 MANAGEMENT INFORMATION SYSTEMS AND STATISTICS
## 171 MISCELLANEOUS BUSINESS & MEDICAL ADMINISTRATION
## 172 HISTORY
## 173 UNITED STATES HISTORY
## Major_category Total Employed
## 1 Agriculture & Natural Resources 128148 90245
## 2 Agriculture & Natural Resources 95326 76865
## 3 Agriculture & Natural Resources 33955 26321
## 4 Agriculture & Natural Resources 103549 81177
## 5 Agriculture & Natural Resources 24280 17281
## 6 Agriculture & Natural Resources 79409 63043
## 7 Agriculture & Natural Resources 6586 4926
## 8 Agriculture & Natural Resources 8549 6392
## 9 Biology & Life Science 106106 87602
## 10 Agriculture & Natural Resources 69447 48228
## 11 Agriculture & Natural Resources 83188 65937
## 12 Engineering 294692 216770
## 13 Humanities & Liberal Arts 103740 75798
## 14 Communications & Journalism 987676 790696
## 15 Communications & Journalism 418104 314438
## 16 Communications & Journalism 211213 170474
## 17 Communications & Journalism 186829 147433
## 18 Computers & Mathematics 62141 49609
## 19 Computers & Mathematics 253782 218248
## 20 Computers & Mathematics 29317 22828
## 21 Computers & Mathematics 783292 656372
## 22 Computers & Mathematics 77805 66393
## 23 Computers & Mathematics 39362 32366
## 24 Computers & Mathematics 51771 44071
## 25 Industrial Arts & Consumer Services 42325 33388
## 26 Education 1438867 843693
## 27 Education 4037 3113
## 28 Education 2396 1492
## 29 Education 1446701 819393
## 30 Education 68808 47203
## 31 Education 281661 193542
## 32 Education 157079 113460
## 33 Education 56477 36224
## 34 Education 224262 129486
## 35 Education 149689 108272
## 36 Education 127022 78785
## 37 Education 88067 58885
## 38 Education 181445 111347
## 39 Education 231861 155159
## 40 Education 225553 126054
## 41 Engineering 503080 359172
## 42 Engineering 65734 44944
## 43 Engineering 32748 24270
## 44 Engineering 19587 13713
## 45 Engineering 18347 12876
## 46 Engineering 188046 131697
## 47 Engineering 358593 262831
## 48 Engineering 154160 128742
## 49 Engineering 671647 489965
## 50 Engineering 20582 14909
## 51 Engineering 13016 9849
## 52 Engineering 6264 4120
## 53 Engineering 138366 101273
## 54 Engineering 21430 14687
## 55 Engineering 581529 422207
## 56 Engineering 12818 6939
## 57 Engineering 10746 7416
## 58 Engineering 16094 10690
## 59 Engineering 9826 7320
## 60 Engineering 19631 14002
## 61 Engineering 57006 43906
## 62 Engineering 37382 30102
## 63 Engineering 47098 27275
## 64 Engineering 94697 73737
## 65 Engineering 82142 65401
## 66 Engineering 29348 24190
## 67 Engineering 64196 53097
## 68 Humanities & Liberal Arts 75791 45657
## 69 Humanities & Liberal Arts 236342 153654
## 70 Humanities & Liberal Arts 57793 34696
## 71 Industrial Arts & Consumer Services 402038 241585
## 72 Law & Public Policy 9330 7270
## 73 Law & Public Policy 67037 49259
## 74 Humanities & Liberal Arts 1098647 708882
## 75 Humanities & Liberal Arts 59211 44913
## 76 Humanities & Liberal Arts 601221 404932
## 77 Humanities & Liberal Arts 46188 29971
## 78 Education 16193 7091
## 79 Biology & Life Science 839454 583079
## 80 Biology & Life Science 75322 52594
## 81 Biology & Life Science 14135 9284
## 82 Biology & Life Science 28197 20221
## 83 Biology & Life Science 45368 36708
## 84 Biology & Life Science 6362 4747
## 85 Biology & Life Science 68885 45422
## 86 Biology & Life Science 5015 3481
## 87 Biology & Life Science 43984 31394
## 88 Biology & Life Science 55395 35714
## 89 Biology & Life Science 13676 8987
## 90 Biology & Life Science 29389 22298
## 91 Computers & Mathematics 432806 280902
## 92 Computers & Mathematics 19112 15136
## 93 Computers & Mathematics 24806 18808
## 94 Industrial Arts & Consumer Services 4315 1650
## 95 Interdisciplinary 45199 35706
## 96 Humanities & Liberal Arts 56580 43114
## 97 Health 64534 43878
## 98 Computers & Mathematics 7184 5874
## 99 Biology & Life Science 6898 5527
## 100 Social Science 61871 43312
## 101 Industrial Arts & Consumer Services 350409 286683
## 102 Humanities & Liberal Arts 205763 138734
## 103 Humanities & Liberal Arts 232865 164827
## 104 Physical Sciences 8856 5872
## 105 Physical Sciences 4700 3400
## 106 Physical Sciences 14051 11252
## 107 Physical Sciences 308062 198075
## 108 Physical Sciences 107902 75698
## 109 Physical Sciences 8267 6129
## 110 Physical Sciences 10741 7882
## 111 Physical Sciences 122620 80797
## 112 Engineering 7208 5866
## 113 Physical Sciences 427953 308461
## 114 Physical Sciences 12166 9560
## 115 Psychology & Social Work 1484075 1055854
## 116 Psychology & Social Work 14041 8751
## 117 Psychology & Social Work 7638 5128
## 118 Psychology & Social Work 17633 13071
## 119 Psychology & Social Work 17969 11878
## 120 Psychology & Social Work 10871 6897
## 121 Psychology & Social Work 34102 23921
## 122 Law & Public Policy 757141 613369
## 123 Law & Public Policy 54636 37879
## 124 Law & Public Policy 14782 11147
## 125 Psychology & Social Work 81786 61402
## 126 Psychology & Social Work 319163 225081
## 127 Social Science 127363 80165
## 128 Social Science 757616 535446
## 129 Humanities & Liberal Arts 143087 102399
## 130 Social Science 75085 59534
## 131 Social Science 115423 83671
## 132 Social Science 77371 56564
## 133 Social Science 748956 541630
## 134 Social Science 674558 459174
## 135 Social Science 15882 12307
## 136 Industrial Arts & Consumer Services 92346 79055
## 137 Industrial Arts & Consumer Services 15726 12607
## 138 Industrial Arts & Consumer Services 126639 98814
## 139 Arts 571961 386961
## 140 Arts 174817 135071
## 141 Arts 276262 192704
## 142 Arts 55141 41098
## 143 Arts 504657 379980
## 144 Arts 133508 107651
## 145 Humanities & Liberal Arts 90852 61295
## 146 Arts 81008 58799
## 147 Arts 8511 6431
## 148 Health 104516 78198
## 149 Health 74977 49393
## 150 Health 108510 85360
## 151 Health 64316 51279
## 152 Health 164990 121479
## 153 Health 32514 19009
## 154 Health 1769892 1325711
## 155 Health 180084 124058
## 156 Health 252138 199174
## 157 Health 56741 42543
## 158 Health 77647 52610
## 159 Business 2148712 1580978
## 160 Business 1779219 1335825
## 161 Business 9763 7846
## 162 Business 3123510 2354398
## 163 Business 57200 47341
## 164 Business 75547 57983
## 165 Business 1114624 890125
## 166 Business 816548 670681
## 167 Business 187274 142879
## 168 Business 86064 66453
## 169 Business 200854 163393
## 170 Business 156673 134478
## 171 Business 102753 77471
## 172 Humanities & Liberal Arts 712509 478416
## 173 Humanities & Liberal Arts 17746 11887
## Employed_full_time_year_round Unemployed Unemployment_rate Median P25th
## 1 74078 2423 0.02614711 50000 34000
## 2 64240 2266 0.02863606 54000 36000
## 3 22810 821 0.03024832 63000 40000
## 4 64937 3619 0.04267890 46000 30000
## 5 12722 894 0.04918845 62000 38500
## 6 51077 2070 0.03179089 50000 35000
## 7 4042 264 0.05086705 63000 39400
## 8 5074 261 0.03923042 52000 35000
## 9 65238 4736 0.05128983 52000 38000
## 10 39613 2144 0.04256333 58000 40500
## 11 50595 3789 0.05434128 52000 37100
## 12 163020 20394 0.08599113 63000 40400
## 13 50530 5525 0.06793896 46000 32000
## 14 595739 54390 0.06436031 50000 35000
## 15 235407 20754 0.06191675 50000 35000
## 16 125489 15431 0.08300476 48000 32000
## 17 111552 10624 0.06721626 50000 34000
## 18 37261 4609 0.08500867 50000 34500
## 19 189950 11945 0.05189124 65000 45000
## 20 18747 2265 0.09026422 60000 40000
## 21 561052 34196 0.04951866 78000 51000
## 22 57604 3704 0.05284106 68000 46200
## 23 28156 2626 0.07504572 55000 40000
## 24 35954 2748 0.05869412 55000 36000
## 25 25780 1941 0.05494070 40000 26200
## 26 591863 38742 0.04390352 43000 32000
## 27 2468 0 0.00000000 58000 44750
## 28 1093 169 0.10174594 41000 33200
## 29 501786 32685 0.03835916 40000 31000
## 30 29494 1610 0.03298302 43000 34000
## 31 136343 9389 0.04626696 48400 34000
## 32 71133 5890 0.04935065 35300 27000
## 33 24817 1596 0.04219989 46000 35000
## 34 88917 5925 0.04375568 45000 34000
## 35 71615 5357 0.04714466 42000 34000
## 36 51632 3800 0.04601320 45000 33000
## 37 37892 2032 0.03335686 40000 30000
## 38 67651 5624 0.04808029 42000 32000
## 39 94756 6629 0.04097337 42600 32000
## 40 91322 5145 0.03921524 50000 35600
## 41 312023 17986 0.04768824 75000 50000
## 42 38491 1969 0.04197131 80000 58000
## 43 18621 1521 0.05897406 62000 40000
## 44 11180 1017 0.06904277 78000 50000
## 45 9202 1105 0.07903583 65000 40000
## 46 109406 6388 0.04626136 86000 60000
## 47 220528 14823 0.05338659 78000 55000
## 48 111025 7456 0.05474383 80000 60000
## 49 422317 26064 0.05050879 88000 60000
## 50 12257 683 0.04380452 65000 45000
## 51 8104 472 0.04573200 70000 50000
## 52 3350 0 0.00000000 85000 55000
## 53 85014 5498 0.05149338 75000 50000
## 54 11871 933 0.05973111 78000 55000
## 55 362053 19360 0.04384386 80000 59000
## 56 5462 326 0.04487268 96000 65000
## 57 6419 366 0.04703161 92000 52000
## 58 9226 449 0.04030882 97000 60000
## 59 6474 527 0.06715942 95000 65000
## 60 11636 617 0.04220535 125000 75000
## 61 37194 2744 0.05882101 70000 50000
## 62 25651 1475 0.04671121 63000 40000
## 63 22104 1577 0.05465826 74000 50000
## 64 64157 4572 0.05838409 67000 46900
## 65 57266 3431 0.04984600 70000 48000
## 66 21273 1101 0.04353327 60000 40000
## 67 46183 3401 0.06019682 63000 42000
## 68 30428 4043 0.08134809 48000 30000
## 69 99459 9598 0.05879254 48000 33500
## 70 23046 2707 0.07237387 45000 30000
## 71 154167 14273 0.05578485 40500 30000
## 72 6143 518 0.06651258 50000 34000
## 73 37254 3699 0.06984780 48000 34000
## 74 482229 52248 0.06864530 50000 32900
## 75 29628 3569 0.07361495 40000 28800
## 76 296792 29348 0.06757852 50000 33000
## 77 19460 2530 0.07784376 46700 30000
## 78 4330 743 0.09484299 40000 30000
## 79 422788 36757 0.05930117 51000 35000
## 80 37103 4056 0.07159753 53000 33000
## 81 6333 327 0.03402351 50000 32000
## 82 13366 1303 0.06053708 45000 30000
## 83 25677 1888 0.04891699 47500 32000
## 84 3498 206 0.04159095 48000 33000
## 85 33990 2435 0.05088075 60000 40000
## 86 2579 57 0.01611080 60000 35000
## 87 20207 1692 0.05113946 50000 30000
## 88 26152 1815 0.04836260 55000 34000
## 89 5446 665 0.06889764 35000 28000
## 90 16508 1114 0.04758244 52000 33500
## 91 209838 15701 0.05293608 66000 42000
## 92 12109 892 0.05565261 70000 47000
## 93 14468 1138 0.05705405 70000 43000
## 94 1708 187 0.10179641 64000 39750
## 95 26038 2990 0.07726897 43000 32000
## 96 27499 3462 0.07433013 45000 30000
## 97 28112 2961 0.06321655 49500 34000
## 98 5039 150 0.02490040 92000 53000
## 99 3639 284 0.04887283 53000 31500
## 100 31078 3030 0.06538345 45000 33000
## 101 204242 14108 0.04690300 44000 30000
## 102 95429 11252 0.07502033 45000 30000
## 103 121606 7317 0.04250511 40000 27000
## 104 4961 238 0.03895254 60000 38000
## 105 2447 320 0.08602150 80000 40000
## 106 9098 429 0.03672631 60000 39000
## 107 153308 11468 0.05472862 59000 38700
## 108 59262 5272 0.06511053 65000 42000
## 109 5020 274 0.04279244 57000 36000
## 110 6508 449 0.05389509 55000 40000
## 111 60812 4440 0.05209006 70000 40000
## 112 4505 134 0.02233333 75000 60000
## 113 238933 14613 0.04523112 56000 38000
## 114 7238 718 0.06985795 62000 45000
## 115 736817 79066 0.06966658 45000 31000
## 116 5763 716 0.07563114 40000 33000
## 117 3297 587 0.10271216 45000 26100
## 118 8888 954 0.06802139 39000 25000
## 119 8631 1084 0.08362907 62000 40000
## 120 5226 660 0.08733625 47000 35000
## 121 15688 2137 0.08200936 45000 30000
## 122 517599 35037 0.05403559 50000 35000
## 123 31262 2836 0.06965492 56000 40000
## 124 8196 959 0.07921692 60000 38000
## 125 44959 4794 0.07242129 38000 29000
## 126 164020 14208 0.05937590 40000 30000
## 127 57036 6132 0.07105693 50000 35000
## 128 430580 34974 0.06131272 69000 42000
## 129 66046 8684 0.07817578 43000 30000
## 130 48763 4106 0.06451917 49000 35000
## 131 63070 6202 0.06900849 54000 38300
## 132 42091 4278 0.07031327 55000 40000
## 133 421761 40376 0.06937385 58000 38000
## 134 336515 32344 0.06580430 47000 33000
## 135 9444 708 0.05439877 52000 40000
## 136 65916 4257 0.05109708 65000 45000
## 137 10453 692 0.05203399 48000 32000
## 138 83519 4902 0.04726368 67000 42500
## 139 256747 29912 0.07175327 45000 30000
## 140 81519 11789 0.08027373 42000 29000
## 141 116142 11155 0.05471919 45000 30000
## 142 23479 4297 0.09465800 40000 27000
## 143 266671 30330 0.07391972 46600 32000
## 144 69303 10080 0.08561891 47000 30000
## 145 38989 4185 0.06391265 44500 30000
## 146 36943 5372 0.08371383 37600 24900
## 147 3802 1190 0.15614749 45000 30000
## 148 53746 4525 0.05470063 50000 35000
## 149 26085 2407 0.04646718 42000 30000
## 150 67294 5160 0.05700398 50000 35000
## 151 25118 1660 0.03135685 55000 37000
## 152 92128 4564 0.03620987 60000 45000
## 153 13147 1431 0.07000979 50000 34000
## 154 947546 36503 0.02679682 62000 48000
## 155 89234 4414 0.03435768 106000 78000
## 156 128115 5378 0.02629160 61000 40000
## 157 28912 3032 0.06652770 47000 32800
## 158 35676 2978 0.05357271 45000 32000
## 159 1304646 85626 0.05137753 60000 40000
## 160 1095027 75379 0.05341467 65000 42500
## 161 6880 466 0.05606352 72000 53000
## 162 1939384 147261 0.05886534 58000 39500
## 163 41104 2141 0.04326826 65000 45000
## 164 48471 3816 0.06174857 65000 45000
## 165 704912 51839 0.05503289 56000 38500
## 166 561073 34166 0.04847293 65000 45000
## 167 116466 9241 0.06074809 54000 38000
## 168 51012 5106 0.07135371 54000 38600
## 169 122499 8862 0.05144698 49000 33000
## 170 118249 6186 0.04397714 72000 50000
## 171 61603 4308 0.05267856 53000 36000
## 172 354163 33725 0.06585101 50000 35000
## 173 8204 943 0.07349961 50000 39000
## P75th
## 1 80000
## 2 80000
## 3 98000
## 4 72000
## 5 90000
## 6 75000
## 7 88000
## 8 75000
## 9 75000
## 10 80000
## 11 75000
## 12 93500
## 13 71000
## 14 80000
## 15 80000
## 16 70000
## 17 75000
## 18 75000
## 19 90000
## 20 85000
## 21 105000
## 22 95000
## 23 80000
## 24 80000
## 25 60000
## 26 59000
## 27 79000
## 28 50000
## 29 50000
## 30 60000
## 31 66500
## 32 45800
## 33 61000
## 34 60000
## 35 53000
## 36 64000
## 37 51000
## 38 54000
## 39 56000
## 40 71000
## 41 100000
## 42 110000
## 43 91000
## 44 102000
## 45 96000
## 46 120000
## 47 105000
## 48 107000
## 49 116000
## 50 100000
## 51 95000
## 52 125000
## 53 101000
## 54 105000
## 55 110000
## 56 123000
## 57 124000
## 58 125000
## 59 128000
## 60 210000
## 61 100000
## 62 93000
## 63 107000
## 64 91000
## 65 98000
## 66 82000
## 67 90000
## 68 70000
## 69 69000
## 70 75000
## 71 60000
## 72 75000
## 73 70000
## 74 75000
## 75 65000
## 76 75000
## 77 70000
## 78 55000
## 79 80000
## 80 82000
## 81 75000
## 82 70000
## 83 73000
## 84 80000
## 85 85000
## 86 105000
## 87 75000
## 88 85000
## 89 52000
## 90 72800
## 91 100000
## 92 106000
## 93 102000
## 94 90000
## 95 55000
## 96 69000
## 97 69000
## 98 136000
## 99 93000
## 100 67000
## 101 60000
## 102 70000
## 103 56000
## 104 89000
## 105 106000
## 106 90000
## 107 90000
## 108 100000
## 109 80000
## 110 90000
## 111 110000
## 112 100000
## 113 85000
## 114 80000
## 115 68000
## 116 70000
## 117 62000
## 118 50000
## 119 84000
## 120 70000
## 121 70000
## 122 74000
## 123 85000
## 124 90000
## 125 52000
## 126 53000
## 127 75000
## 128 110000
## 129 68000
## 130 72000
## 131 78000
## 132 89000
## 133 90000
## 134 70000
## 135 80000
## 136 95000
## 137 75000
## 138 98000
## 139 70000
## 140 62000
## 141 67000
## 142 59000
## 143 70000
## 144 70000
## 145 70000
## 146 58000
## 147 60000
## 148 73000
## 149 60000
## 150 75000
## 151 75000
## 152 76000
## 153 85000
## 154 80000
## 155 125000
## 156 80000
## 157 70000
## 158 62000
## 159 95000
## 160 100000
## 161 115000
## 162 86000
## 163 90000
## 164 100000
## 165 90000
## 166 100000
## 167 80000
## 168 80000
## 169 70000
## 170 100000
## 171 83000
## 172 80000
## 173 81000
library(odbc)
# Creating connection
mysqldbTBConn = dbConnect(RMySQL::MySQL(),
dbname= 'md.asaduzzaman39',
host= 'cunydata607sql.mysql.database.azure.com',
port=3306,
user='md.asaduzzaman39',
password='c1706f410226ffca')
dbListTables(mysqldbTBConn)
## [1] "airline_data" "color" "manufacturer" "model" "product"
#create table product:
CREATE TABLE md.asaduzzaman39
.product
(
product_name
VARCHAR(45) NULL, manufacturer
VARCHAR(45) NULL, color
VARCHAR(45) NULL,
price
INT NULL, model
VARCHAR(45) NULL,
munber in stock
VARCHAR(45) NULL);
insert into md.asaduzzaman39
.product
(
product_name
, manufacturer
,
color
, price
, model
,
munber in stock
) values (‘phone’,‘apple’,‘red,
while,black’,‘799’,‘iphone 16, iphone 16 pro, iphone 16 pro max’,
21);
Table that is not normalized:
result = dbSendQuery(mysqldbTBConn,"select * from product")
customerProduct <- fetch(result)
print(customerProduct)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
1NF:
CREATE TABLE md.asaduzzaman39
.product
(
product_id
INT NULL, product_name
VARCHAR(45)
NULL, manufacturer
VARCHAR(45) NULL, color
VARCHAR(45) NULL, price
INT NULL, model
VARCHAR(45) NULL, munber in stock
VARCHAR(45) NULL);
multiple data in one row like color and model. Put it into separate rows:
insert into md.asaduzzaman39
.product
(
product_id
, product_name
,
manufacturer
, color
, price
,
model
, munber in stock
) values (111,
‘phone’,‘apple’,‘red’,‘799’,‘iphone 16’, 21); insert into
md.asaduzzaman39
.product
(
product_id
, product_name
,
manufacturer
, color
, price
,
model
, munber in stock
) values (111,
‘phone’,‘apple’,’ while’,‘799’,’ iphone 16 pro’, 21); insert into
md.asaduzzaman39
.product
(
product_id
, product_name
,
manufacturer
, color
, price
,
model
, munber in stock
) values (111,
‘phone’,‘apple’,‘black’,‘799’,‘iphone 16 pro max’, 21);
result = dbSendQuery(mysqldbTBConn,"select * from product")
customer <- fetch(result)
print(customer)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
# create table with PK:
CREATE TABLE md.asaduzzaman39
.product
(
product_id
INT NOT NULL, product_name
VARCHAR(45) NULL, manufacturer
VARCHAR(45) NULL,
color
VARCHAR(45) NULL, price
INT NULL,
model
VARCHAR(45) NULL, munber in stock
VARCHAR(45) NULL, PRIMARY KEY (prouct_id
));
insert into md.asaduzzaman39
.product
(
product_id
, product_name
,
manufacturer
, color
, price
,
model
, munber in stock
) values
(111,‘phone’,‘apple’,‘red’,‘799’,‘iphone 16’, 21);
result = dbSendQuery(mysqldbTBConn,"select * from product")
Product <- fetch(result)
print(Product)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
CREATE TABLE md.asaduzzaman39
.product
(
product_id
INT NOT NULL, product_name
VARCHAR(45) NULL, PRIMARY KEY (product_id
));
insert into md.asaduzzaman39
.product
(
product_id
, product_name
) values (111,
‘phone’); insert into md.asaduzzaman39
.product
( product_id
, product_name
) values (112,
‘phone’); insert into md.asaduzzaman39
.product
( product_id
, product_name
) values (113,
‘phone’);
result = dbSendQuery(mysqldbTBConn,"select * from product ")
department <- fetch(result)
print(department)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
#create table model
CREATE TABLE md.asaduzzaman39
.model
(
model_id
INT NOT NULL, model_name
VARCHAR(45)
NULL, price
INT NULL, PRIMARY KEY
(model_id
));
result = dbSendQuery(mysqldbTBConn,"select * from model ")
department <- fetch(result)
print(department)
## model_id color_id model_name price
## 1 101 222 iphone16 899
## 2 102 223 iphone16 pro 999
## 3 103 224 iphone16 pro max 1199
CREATE TABLE md.asaduzzaman39
.color
(
color_id
INT NOT NULL, color_name
VARCHAR(45)
NULL, PRIMARY KEY (color_id
));
result = dbSendQuery(mysqldbTBConn,"select * from color ")
department <- fetch(result)
print(department)
## color_id color_name
## 1 222 red
## 2 223 white
## 3 224 black
#Create table manufacturer
CREATE TABLE md.asaduzzaman39
.manufacturer
( manufacturer_id
INT NOT NULL,
manufacturer_name
VARCHAR(45) NULL, PRIMARY KEY
(manufacturer_id
));
result = dbSendQuery(mysqldbTBConn,"select * from manufacturer")
department <- fetch(result)
print(department)
## manufacturer_id manufacturer_name
## 1 1 Apple
CREATE TABLE md.asaduzzaman39
.product
(
product_id
INT NOT NULL, model_id
INT NULL,
color_id
INT NULL, manufacturer_id
INT NULL,
product_name
VARCHAR(45) NULL, PRIMARY KEY
(product_id
));
#insert into table
insert into md.asaduzzaman39
.product
(
product_id
, model_id
, color_id
,
manufacturer_id
, product_name
) values
(111,101,222,1,‘phone’);
insert into md.asaduzzaman39
.product
(
product_id
, model_id
, color_id
,
manufacturer_id
, product_name
) values
(112,102,223,1,‘phone’);
insert into md.asaduzzaman39
.product
(
product_id
, model_id
, color_id
,
manufacturer_id
, product_name
) values
(113,103,224,1,‘phone’);
result = dbSendQuery(mysqldbTBConn,"select * from product")
department <- fetch(result)
print(department)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
CREATE TABLE md.asaduzzaman39
.product
(
product_id
INT NOT NULL, model_id
INT NULL,
manufacturer_id
INT NULL, product_name
VARCHAR(45) NULL, PRIMARY KEY (product_id
));
insert into md.asaduzzaman39
.product
(
product_id
, model_id
,
manufacturer_id
, product_name
) values
(111,101,1,‘phone’);
insert into md.asaduzzaman39
.product
(
product_id
, model_id
,
manufacturer_id
, product_name
) values
(112,102,1,‘phone’);
insert into md.asaduzzaman39
.product
(
product_id
, model_id
,
manufacturer_id
, product_name
) values
(113,103,1,‘phone’);
#
result = dbSendQuery(mysqldbTBConn,"select * from product")
department <- fetch(result)
print(department)
## product_id model_id manufacturer_id product_name
## 1 111 101 1 phone
## 2 112 102 1 phone
## 3 113 103 1 phone
INSERT INTO md.asaduzzaman39
.model
(model_id
, color_id
, model_name
)
VALUES (‘101’, ‘222’, ‘iphone16’); INSERT INTO
md.asaduzzaman39
.model
(model_id
,
color_id
, model_name
) VALUES (‘102’, ‘223’,
‘iphone16 pro’); INSERT INTO
md.asaduzzaman39
.model
(model_id
,
color_id
, model_name
) VALUES (‘103’, ‘224’,
‘iphone16 pro max’);
CREATE TABLE md.asaduzzaman39
.model
(
model_id
INT NOT NULL, color_id
INT NOT NULL,
model_name
VARCHAR(45) NULL, price
INT NULL,
PRIMARY KEY (model_id
));
result = dbSendQuery(mysqldbTBConn,"select * from model")
department <- fetch(result)
print(department)
## model_id color_id model_name price
## 1 101 222 iphone16 899
## 2 102 223 iphone16 pro 999
## 3 103 224 iphone16 pro max 1199
Note: product table have relation with model table and model table have relation color table. So, product table can create relation with color table through model table.
#write join the all table together.
result = dbSendQuery(mysqldbTBConn,"select p.Product_id,p.product_name,m.model_id,m.model_name,m.price, m.price,f.manufacturer_id,f.manufacturer_name,c.color_id,c.color_name
from Product p join model m on p.model_id=m.model_id
join manufacturer f on p.manufacturer_id =f.manufacturer_id
join color c on m.color_id=c.color_id ")
department <- fetch(result)
print(department)
## Product_id product_name model_id model_name price price manufacturer_id
## 1 111 phone 101 iphone16 899 899 1
## 2 112 phone 102 iphone16 pro 999 999 1
## 3 113 phone 103 iphone16 pro max 1199 1199 1
## manufacturer_name color_id color_name
## 1 Apple 222 red
## 2 Apple 223 white
## 3 Apple 224 black
`
#install.packages("BiocManager")
#BiocManager::install("EBImage")
library("EBImage")
##
## Attaching package: 'EBImage'
## The following object is masked from 'package:purrr':
##
## transpose
myImage = readImage("Screenshot.png")
display(myImage,method ="raster")
dataframe1 <- data[,c("Major_code","Major","Major_category","Total","Employed","Unemployed")]
# table1<- table(dataframe1$Major_code, dataframe1$Major,dataframe1$Major_category)
#
# table1
# table2 <- table(dataframe1$Total,dataframe1$Employed, dataframe1$Unemployed)
# table2
normalize_fun <- function(x){
return ((x - min(x, na.rm = TRUE))/(max(x, na.rm = TRUE) -(min(x, na.rm = TRUE))))
}
normalize_data <- as.data.frame(apply(data[4:6],2,normalize_fun))
normalize_data
## Total Employed Employed_full_time_year_round
## 1 0.0402907423 0.0377205889 0.0376543047
## 2 0.0297746253 0.0320340039 0.0325786995
## 3 0.0101114538 0.0105524828 0.0112042000
## 4 0.0324092616 0.0338666313 0.0329382946
## 5 0.0070115991 0.0067104253 0.0059996151
## 6 0.0246748437 0.0261595661 0.0257876655
## 7 0.0013424694 0.0014594718 0.0015214434
## 8 0.0019714115 0.0020825311 0.0020538712
## 9 0.0332285203 0.0365972971 0.0330935861
## 10 0.0214830346 0.0198630970 0.0198731769
## 11 0.0258856293 0.0273895345 0.0255389929
## 12 0.0936511771 0.0914945178 0.0835411195
## 13 0.0324704577 0.0315805221 0.0255054582
## 14 0.3156821571 0.3354167145 0.3067888155
## 15 0.1331921871 0.1330040384 0.1208869050
## 16 0.0669046373 0.0718184237 0.0641781858
## 17 0.0590920421 0.0620258523 0.0569878310
## 18 0.0191422037 0.0204500307 0.0186597369
## 19 0.0805436777 0.0921226772 0.0974348021
## 20 0.0086254459 0.0090679356 0.0091080235
## 21 0.2501978460 0.2783281610 0.2888931538
## 22 0.0241609246 0.0275833374 0.0291550650
## 23 0.0118438481 0.0131216462 0.0139622998
## 24 0.0158196721 0.0180963455 0.0179854315
## 25 0.0127931886 0.0135560027 0.0127364776
## 26 0.4602430414 0.3579407762 0.3047891158
## 27 0.0005257738 0.0006889353 0.0007093878
## 28 0.0000000000 0.0000000000 0.0000000000
## 29 0.4627530427 0.3476131218 0.2583167337
## 30 0.0212783000 0.0194274654 0.0146525986
## 31 0.0894760653 0.0816224703 0.0697779642
## 32 0.0495601891 0.0475871114 0.0361349250
## 33 0.0173274671 0.0147613207 0.0122396482
## 34 0.0710855163 0.0543982633 0.0453100179
## 35 0.0471924447 0.0453821785 0.0363835977
## 36 0.0399299737 0.0328500161 0.0260740002
## 37 0.0274488532 0.0243923897 0.0189852814
## 38 0.0573670170 0.0466890730 0.0343384972
## 39 0.0735202239 0.0653094514 0.0483224655
## 40 0.0714991506 0.0529396414 0.0465508017
## 41 0.1604183634 0.1520162726 0.1604145095
## 42 0.0202933952 0.0184673761 0.0192943165
## 43 0.0097247329 0.0096807947 0.0090430178
## 44 0.0055079693 0.0051940027 0.0052040689
## 45 0.0051106752 0.0048382723 0.0041835823
## 46 0.0594819670 0.0553379523 0.0558806701
## 47 0.1141249567 0.1110707355 0.1132105551
## 48 0.0486249461 0.0540820585 0.0567159420
## 49 0.2144269642 0.2076041287 0.2173172140
## 50 0.0058267657 0.0057023102 0.0057597131
## 51 0.0034026312 0.0035517781 0.0036171039
## 52 0.0012393011 0.0011169167 0.0011644278
## 53 0.0435645734 0.0424075590 0.0432963884
## 54 0.0060984636 0.0056079588 0.0055605686
## 55 0.1855532992 0.1788065482 0.1862259073
## 56 0.0033391924 0.0023150096 0.0022540475
## 57 0.0026753268 0.0025177376 0.0027477814
## 58 0.0043888176 0.0039092084 0.0041959644
## 59 0.0023805603 0.0024769370 0.0027761569
## 60 0.0055220668 0.0053168295 0.0054393277
## 61 0.0174969578 0.0180262195 0.0186251703
## 62 0.0112094592 0.0121594318 0.0126699242
## 63 0.0143224503 0.0109579388 0.0108399616
## 64 0.0295730947 0.0307045840 0.0325358783
## 65 0.0255504925 0.0271617311 0.0289806845
## 66 0.0086353783 0.0096467942 0.0104112334
## 67 0.0198006225 0.0219324529 0.0232627609
## 68 0.0235156422 0.0187704056 0.0151344664
## 69 0.0749559292 0.0646698168 0.0507488298
## 70 0.0177491114 0.0141119110 0.0113259567
## 71 0.1280446661 0.1020410505 0.0789736938
## 72 0.0022216427 0.0024556867 0.0026053879
## 73 0.0207108744 0.0203012785 0.0186561254
## 74 0.3512370903 0.3006452446 0.2482269174
## 75 0.0182034363 0.0184542009 0.0147217317
## 76 0.1918625850 0.1714645634 0.1525565563
## 77 0.0140308877 0.0121037560 0.0094758733
## 78 0.0044205370 0.0023796106 0.0016700279
## 79 0.2681920622 0.2471781703 0.2175602115
## 80 0.0233653753 0.0217186747 0.0185782217
## 81 0.0037611571 0.0033116495 0.0027034124
## 82 0.0082665997 0.0079599440 0.0063318666
## 83 0.0137681610 0.0149670238 0.0126833381
## 84 0.0012707001 0.0013833957 0.0012407838
## 85 0.0213029707 0.0186705291 0.0169721677
## 86 0.0008391235 0.0008453376 0.0007666547
## 87 0.0133247296 0.0127085400 0.0098612644
## 88 0.0169807960 0.0145445674 0.0129283993
## 89 0.0036140942 0.0031854226 0.0022457928
## 90 0.0086485146 0.0088426822 0.0079528822
## 91 0.1379026847 0.1187510253 0.1076953873
## 92 0.0053557800 0.0057987867 0.0056833571
## 93 0.0071801286 0.0073594100 0.0069004087
## 94 0.0006148446 0.0000671510 0.0003172898
## 95 0.0137140137 0.0145411674 0.0128695846
## 96 0.0173604681 0.0176896145 0.0136233414
## 97 0.0199089171 0.0180143193 0.0139395994
## 98 0.0015340676 0.0018623778 0.0020358140
## 99 0.0014424337 0.0017149006 0.0013135283
## 100 0.0190556961 0.0177737657 0.0154698134
## 101 0.1115028160 0.1212079871 0.1048083079
## 102 0.0651584659 0.0583287220 0.0486696786
## 103 0.0738419039 0.0694184128 0.0621748747
## 104 0.0020697738 0.0018615278 0.0019955724
## 105 0.0007381980 0.0008109121 0.0006985535
## 106 0.0037342436 0.0041480620 0.0041299268
## 107 0.0979349040 0.0835490241 0.0785305199
## 108 0.0338039559 0.0315380215 0.0300104577
## 109 0.0018810591 0.0019707545 0.0020260116
## 110 0.0026737248 0.0027157906 0.0027936982
## 111 0.0385195799 0.0337051289 0.0308101312
## 112 0.0015417572 0.0018589778 0.0017603136
## 113 0.1363477912 0.1304637754 0.1227060333
## 114 0.0031302926 0.0034289513 0.0031703186
## 115 0.4747276133 0.4481105493 0.3795735522
## 116 0.0037310396 0.0030851211 0.0024093389
## 117 0.0016795285 0.0015453231 0.0011370842
## 118 0.0048819108 0.0049211486 0.0040215840
## 119 0.0049895646 0.0044141160 0.0038889929
## 120 0.0027153766 0.0022971593 0.0021322908
## 121 0.0101585524 0.0095324675 0.0075298291
## 122 0.2418191069 0.2600516128 0.2664749514
## 123 0.0167376136 0.0154647062 0.0155647423
## 124 0.0039684549 0.0041034363 0.0036645684
## 125 0.0254364307 0.0254621307 0.0226312767
## 126 0.1014916469 0.0950267456 0.0840570379
## 127 0.0400392296 0.0334365249 0.0288620233
## 128 0.2419712961 0.2269338427 0.2215802478
## 129 0.0450771744 0.0428861161 0.0335104481
## 130 0.0232894409 0.0246682188 0.0245938303
## 131 0.0362136724 0.0349265972 0.0319750750
## 132 0.0240218717 0.0234059499 0.0211516227
## 133 0.2391966458 0.2295620820 0.2170303633
## 134 0.2153596440 0.1945177580 0.1730503830
## 135 0.0043208931 0.0045964437 0.0043084346
## 136 0.0288198380 0.0329647678 0.0334433787
## 137 0.0042709110 0.0047239456 0.0048289963
## 138 0.0398072611 0.0413624684 0.0425250904
## 139 0.1824877271 0.1638267742 0.1318966038
## 140 0.0552434163 0.0567719237 0.0414932536
## 141 0.0877462342 0.0812663149 0.0593558965
## 142 0.0168994148 0.0168328017 0.0115493494
## 143 0.1609236318 0.1608598049 0.1370165780
## 144 0.0420080779 0.0451182495 0.0351907944
## 145 0.0283411628 0.0254166550 0.0195512439
## 146 0.0251871607 0.0243558391 0.0184956748
## 147 0.0019592363 0.0020991064 0.0013976230
## 148 0.0327190868 0.0326005374 0.0271646517
## 149 0.0232548379 0.0203582294 0.0128938328
## 150 0.0339987581 0.0356444329 0.0341543143
## 151 0.0198390703 0.0211597913 0.0123949397
## 152 0.0520948610 0.0509952374 0.0469666319
## 153 0.0096497597 0.0074448363 0.0062188804
## 154 0.5663029290 0.5628014889 0.4882925216
## 155 0.0569309548 0.0520913288 0.0454735641
## 156 0.0800169427 0.0840161060 0.0655329876
## 157 0.0174120522 0.0174469358 0.0143523341
## 158 0.0241103016 0.0217254748 0.0178420062
## 159 0.6876762592 0.6712915858 0.6725269838
## 160 0.5692912851 0.5671000031 0.5643806838
## 161 0.0023603752 0.0027004904 0.0029856198
## 162 1.0000000000 1.0000000000 1.0000000000
## 163 0.0175591151 0.0194861163 0.0206424113
## 164 0.0234374650 0.0240090339 0.0244431822
## 165 0.3563560959 0.3776746712 0.3631131755
## 166 0.2608530159 0.2844095769 0.2889039881
## 167 0.0592346194 0.0600903734 0.0595230541
## 168 0.0268070952 0.0276088378 0.0257541308
## 169 0.0635856300 0.0688089537 0.0626355898
## 170 0.0494301073 0.0565198950 0.0604429366
## 171 0.0321542244 0.0322915578 0.0312182227
## 172 0.2275190845 0.2026957303 0.1821553110
## 173 0.0049181158 0.0044179410 0.0036686958
major_data$Major <- toupper(major_data$Major)
data_mjrs <- str_subset(major_data$Major, pattern = "(DATA)|(STATISTICS)")
data_mjrs
## [1] "MANAGEMENT INFORMATION SYSTEMS AND STATISTICS"
## [2] "COMPUTER PROGRAMMING AND DATA PROCESSING"
## [3] "STATISTICS AND DECISION SCIENCE"
data$Major <- toupper(data$Major)
data_mjrs <- str_subset(data$Major, pattern = "(DATA)|(STATISTICS)")
data_mjrs
## [1] "COMPUTER PROGRAMMING AND DATA PROCESSING"
## [2] "STATISTICS AND DECISION SCIENCE"
## [3] "MANAGEMENT INFORMATION SYSTEMS AND STATISTICS"
(.)\1\1 = It would find any same character appearing three times in a row.
library("stringr")
testData <- c("fdraaaaaoijh")
str_extract_all(testData , regex("(.)\\1\\1"))
## [[1]]
## [1] "aaa"
“(.)(.)\2\1” = It would search words that a pair of characters followed by the same pair of characters in reversed order.
Search_in <- c("cdsabbavdf")
str_extract_all(testData , regex("(.)(.)\\2\\1"))
## [[1]]
## [1] "aaaa"
Search_in <- c("scfababthlb")
str_extract_all(Search_in , regex("(..)\\1"))
## [[1]]
## [1] "abab"
“(.).\1.\1” = It would search words with repeated character pairs spaced by 1 character in between.
Data <- c("scfacbababthlb")
str_extract_all(Data , regex("(.).\\1.\\1"))
## [[1]]
## [1] "babab"
“(.)(.)(.).*\3\2\1” = it would search words with any three character pairs repeated three times
Data <- c("applebccfdscbaelppa")
str_extract_all(Data , regex("(.)(.)(.).*\\3\\2\\1"))
## [[1]]
## [1] "applebccfdscbaelppa"
Start and end with the same character.
Start with ^ and end with*$
(“^.*$“)
str_view("churchc", "^(.)(.*)\\1$")
## [1] │ <churchc>
Contain a repeated pair of letters (e.g. “church” contains “ch” repeated
Start with [A-Za-z] and end with [A-Za-z]
str_view("church", "([A-Za-z][A-Za-z]).*\\1")
## [1] │ <church>
Contain one letter repeated in at least three places (e.g. “eleven” contains three “e”s.)
str_view("eleven", "([A-Za-z]).*\\1.*\\1.")
## [1] │ <eleven>