Highlights:

  • 2020 Hispanic Demographic Census
    • Three states with largest population : California (15.4 Million), Texas (11.3 Million), Florida (5.5 Million)
    • State with largest increase from year 2010: Texas with 2,376,780 increase
    • State with largest decrease from year 2010: Porto Rico with 504,245 decrease
    • California county with largest percentage: Imperial County with 85%
  • 2020 Asian Demographic Census
    • Three states with largest population : California (6.8 Million), New York (1.9 Million), Texas (1.6 Million)
    • State with largest increase from year 2010: California with 1,087,060 increase
    • State with largest decrease from year 2010: Hawaii with 229,069 decrease
  • 2020 Black Demographic Census
    • Three states with largest population : Texas (3.8 Million), Florida (3.7 Million), Georgia (3.5 Million)
    • State with larger increase from year 2010: Texas with 444,689 increase
    • State with larger decrease from year 2010: California with 329,710 decrease
  • 2020 White Demographic Census
    • Three states with largest population : California (24.8 Million), Texas (21.7 Million), Florida (16.4 Million)
    • State with larger increase from year 2010: Texas with 1,876,762 increase
    • State with larger decrease from year 2010: California with 1,492,244 decrease

Using Tidycensus R-Package as Data Analysis Tools

  • Tidycensus package (K. Walker and Herman 2021), first released in 2017, is an R package designed to facilitate the process of acquiring and working with US Census Bureau population data in the R environment. The package has two distinct goals:
    • Data retrieval from Census
    • Data manipulation and wrangling for analysis
    • Two core functions that will be the basis of working with TidyCensus:
    • get_acs(): used to pull data from the American Community Survey (ACS)
    • get_decennial(): used to pull data from the Decennial Census

2020 Census Decennial Survey, as population percentage

# 2020 Decennial Census Variables
all_vars = c(
        all = "P2_001N",
        hisp = "P2_002N",
        white = "P2_005N",
        baa = "P2_006N",
        amin = "P2_007N",
        asian = "P2_008N",
        nhopi = "P2_009N",
        other = "P2_010N",
        multi = "P2_011N"
       )




pop2020 <- get_decennial(geography = "state", variables = all_vars, summary_var="P2_001N", year = 2020) %>% 
                         mutate(percent=round(100*(value/summary_value), digits=0)) %>%
                         arrange(as.numeric(GEOID)) 
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
## Note: 2020 decennial Census data use differential privacy, a technique that
## introduces errors into data to preserve respondent confidentiality.
## ℹ Small counts should be interpreted with caution.
## ℹ See https://www.census.gov/library/fact-sheets/2021/protecting-the-confidentiality-of-the-2020-census-redistricting-data.html for additional guidance.
## This message is displayed once per session.
pop2020 %>% filter(variable=="hisp")  %>% select(2,4,6) %>% arrange(desc(percent)) %>% 
 gt() %>%   tab_header(
    title = md("Hispanic Population _ percentage"),
    subtitle = md("2020 Census"))  
Hispanic Population _ percentage
2020 Census
NAME value percent
Puerto Rico 3249043 99
New Mexico 1010811 48
California 15579652 39
Texas 11441717 39
Arizona 2192253 31
Nevada 890257 29
Florida 5697240 26
Colorado 1263390 22
New Jersey 2002575 22
New York 3948032 20
Illinois 2337410 18
Connecticut 623293 17
Rhode Island 182101 17
Utah 492912 15
Oregon 588757 14
Washington 1059213 14
Idaho 239407 13
Kansas 382603 13
Massachusetts 887685 13
Maryland 729745 12
Nebraska 234715 12
Oklahoma 471931 12
Delaware 104290 11
District of Columbia 77652 11
North Carolina 1118596 11
Virginia 908749 11
Georgia 1123457 10
Hawaii 138923 10
Wyoming 59046 10
Arkansas 256847 9
Indiana 554191 8
Pennsylvania 1049615 8
Wisconsin 447290 8
Alaska 49824 7
Iowa 215986 7
Louisiana 322549 7
South Carolina 352838 7
Tennessee 479187 7
Michigan 564422 6
Minnesota 345640 6
Alabama 264047 5
Kentucky 207854 5
Missouri 303068 5
Mississippi 105220 4
Montana 45199 4
New Hampshire 59454 4
North Dakota 33412 4
Ohio 521308 4
South Dakota 38741 4
Maine 26609 2
Vermont 15504 2
West Virginia 34827 2
pop2020 %>% filter(variable=="white")  %>% select(2,4,6) %>% arrange(desc(percent)) %>% 
            gt() %>%   tab_header(
    title = md("White Population _ percentage"),
    subtitle = md("2020 Census")) 
White Population _ percentage
2020 Census
NAME value percent
Maine 1228264 90
Vermont 573201 89
West Virginia 1598834 89
New Hampshire 1200649 87
Iowa 2638201 83
Montana 901318 83
North Dakota 636160 82
Kentucky 3664764 81
Wyoming 469664 81
South Dakota 705583 80
Idaho 1450523 79
Wisconsin 4634018 79
Minnesota 4353880 76
Missouri 4663907 76
Nebraska 1484687 76
Ohio 8954135 76
Indiana 5121004 75
Utah 2465355 75
Pennsylvania 9553417 73
Kansas 2122575 72
Michigan 7295651 72
Oregon 3036158 72
Tennessee 4900246 71
Arkansas 2063550 69
Rhode Island 754050 69
Massachusetts 4748897 68
Colorado 3760663 65
Washington 4918820 64
Alabama 3171351 63
Connecticut 2279232 63
South Carolina 3178552 62
Oklahoma 2407188 61
North Carolina 6312148 60
Delaware 579851 59
Virginia 5058363 59
Alaska 421758 58
Illinois 7472751 58
Louisiana 2596702 56
Mississippi 1639077 55
Arizona 3816547 53
Florida 11100503 52
New Jersey 4816381 52
New York 10598907 52
Georgia 5362156 50
Maryland 2913782 47
Nevada 1425952 46
Texas 11584597 40
District of Columbia 261771 38
New Mexico 772952 37
California 13714587 35
Hawaii 314365 22
Puerto Rico 24548 1
pop2020 %>% filter(variable=="asian")  %>% select(2,4,6) %>% arrange(desc(percent)) %>% 
            gt() %>%   tab_header(
    title = md("Asian Population _ percentage"),
    subtitle = md("2020 Census")) 
Asian Population _ percentage
2020 Census
NAME value percent
Hawaii 531558 37
California 5978795 15
New Jersey 942921 10
Nevada 265991 9
New York 1916329 9
Washington 723062 9
Maryland 417962 7
Massachusetts 504900 7
Virginia 610612 7
Alaska 43449 6
Illinois 747280 6
Connecticut 170459 5
District of Columbia 33192 5
Minnesota 297460 5
Oregon 191797 5
Texas 1561518 5
Delaware 42398 4
Georgia 475680 4
Pennsylvania 506674 4
Arizona 248837 3
Colorado 195220 3
Florida 629626 3
Kansas 85225 3
Michigan 332288 3
Nebraska 52359 3
New Hampshire 35604 3
North Carolina 340059 3
Ohio 296604 3
Rhode Island 38367 3
Wisconsin 174267 3
Alabama 75918 2
Arkansas 51210 2
Indiana 166651 2
Iowa 75017 2
Kentucky 73843 2
Louisiana 85336 2
Missouri 132158 2
New Mexico 35261 2
North Dakota 13050 2
Oklahoma 89653 2
South Carolina 89394 2
South Dakota 13332 2
Tennessee 134302 2
Utah 78618 2
Vermont 11457 2
Idaho 26036 1
Maine 16668 1
Mississippi 32305 1
Montana 8077 1
West Virginia 14903 1
Wyoming 5037 1
Puerto Rico 2746 0
pop2020 %>% filter(variable=="baa")  %>% select(2,4,6) %>% arrange(desc(percent)) %>% 
            gt() %>%   tab_header(
    title = md("Black Population _ percentage"),
    subtitle = md("2020 Census")) 
Black Population _ percentage
2020 Census
NAME value percent
District of Columbia 282066 41
Mississippi 1079001 36
Georgia 3278119 31
Louisiana 1452420 31
Maryland 1795027 29
Alabama 1288159 26
South Carolina 1269031 25
Delaware 212960 22
North Carolina 2107526 20
Virginia 1578090 18
Tennessee 1083772 16
Arkansas 449884 15
Florida 3127052 15
Illinois 1775612 14
New York 2759022 14
Michigan 1358458 13
New Jersey 1154142 12
Ohio 1457180 12
Texas 3444712 12
Missouri 692774 11
Pennsylvania 1368978 11
Connecticut 360937 10
Indiana 637500 9
Nevada 291960 9
Kentucky 357764 8
Massachusetts 457055 7
Minnesota 392850 7
Oklahoma 283242 7
Kansas 163352 6
Wisconsin 366508 6
California 2119286 5
Nebraska 94405 5
Rhode Island 55386 5
Arizona 317161 4
Colorado 221310 4
Iowa 129321 4
Washington 296170 4
West Virginia 64749 4
Alaska 20731 3
North Dakota 26152 3
Hawaii 21877 2
Maine 25115 2
New Mexico 38330 2
Oregon 78658 2
South Dakota 17441 2
Idaho 14785 1
New Hampshire 18655 1
Utah 37192 1
Vermont 8649 1
Wyoming 4735 1
Montana 5077 0
Puerto Rico 4286 0

Population changes from 2010 Census to 2020 census

* Note of caution: when comparing data from year to year, it is important to be consistent in selecting data standards: 
**               ACS one-year estimate, or ACS 5-year estimate, or 10-year Decennial Survey 

* survey application 
** 10-year Decennial surveys are used for general nation-wide analysis
** 5-year ACS surveys  are used for specific demographic analysis and county level geography

2010 Decenial census survey for states

vars10 <- c(Hispanic="P005010", Asian="P005006",White="P005003",Black="P005004")


pop2010 <- get_decennial(geography = "state", variables = vars10, year = 2010,
                    summary_var = "P005001", geometry = F) %>%
                    mutate(pct = round(100 * (value / summary_value),digits = 0))
## Getting data from the 2010 decennial Census
## Using Census Summary File 1
vars20 <- c(Hispanic="P2_002N", Asian="P1_006N",White="P1_003N",Black="P1_004N")
pop2020 <- get_decennial(geography = "state", variables = vars20, year = 2020,
                    summary_var = "P1_001N",  geometry = F) %>%
                    mutate(pct = round(100 * (value / summary_value),digits = 0))
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
#----------------------------------------
hispanic2010 <- filter(pop2010,variable=="Hispanic") %>% arrange(desc(pct)) 
  
gt(hispanic2010[,c(2,4,6)]) %>%  
  tab_header(
    title = "Hispanic Population _ by percentage",
    subtitle = "2010 Census _ All states "
  )
Hispanic Population _ by percentage
2010 Census _ All states
NAME value pct
Puerto Rico 3688455 99
New Mexico 953403 46
California 14013719 38
Texas 9460921 38
Arizona 1895149 30
Nevada 716501 27
Florida 4223806 22
Colorado 1038687 21
New Jersey 1555144 18
New York 3416922 18
Illinois 2027578 16
Connecticut 479087 13
Utah 358340 13
Oregon 450062 12
Rhode Island 130655 12
Idaho 175901 11
Kansas 300042 11
Washington 755790 11
Massachusetts 627654 10
District of Columbia 54749 9
Georgia 853689 9
Hawaii 120842 9
Nebraska 167405 9
Oklahoma 332007 9
Wyoming 50231 9
Delaware 73221 8
Maryland 470632 8
North Carolina 800120 8
Virginia 631825 8
Alaska 39249 6
Arkansas 186050 6
Indiana 389707 6
Pennsylvania 719660 6
Wisconsin 336056 6
Iowa 151544 5
Minnesota 250258 5
South Carolina 235682 5
Tennessee 290059 5
Alabama 185602 4
Louisiana 192560 4
Michigan 436358 4
Missouri 212470 4
Kentucky 132836 3
Mississippi 81481 3
Montana 28565 3
New Hampshire 36704 3
Ohio 354674 3
South Dakota 22119 3
North Dakota 13467 2
Maine 16935 1
Vermont 9208 1
West Virginia 22268 1
#-------------------------------------
asian2010 <- filter(pop2010,variable=="Asian") %>% arrange(desc(pct)) 
gt(asian2010[,c(2,4,6)]) %>%  tab_header(
    title = "Asian Population _ by percentage",
    subtitle = "2010 Census _ All states"
  )
Asian Population _ by percentage
2010 Census _ All states
NAME value pct
Hawaii 513294 38
California 4775070 13
New Jersey 719827 8
Nevada 191047 7
New York 1406194 7
Washington 475634 7
Alaska 37459 5
Illinois 580586 5
Maryland 316694 5
Massachusetts 347495 5
Virginia 436298 5
Connecticut 134091 4
Minnesota 212996 4
Oregon 139436 4
Texas 948426 4
Arizona 170509 3
Colorado 135564 3
Delaware 28308 3
District of Columbia 20818 3
Georgia 311692 3
Pennsylvania 346288 3
Rhode Island 29988 3
Louisiana 69327 2
Florida 445216 2
Indiana 101444 2
Iowa 52597 2
Kansas 66967 2
Michigan 236490 2
Missouri 97221 2
Nebraska 31919 2
New Hampshire 28241 2
North Carolina 206579 2
Ohio 190765 2
Oklahoma 64154 2
Utah 54176 2
Wisconsin 128052 2
Alabama 52937 1
Arkansas 35647 1
Kentucky 48338 1
Idaho 18529 1
Maine 13442 1
Mississippi 25477 1
Montana 6138 1
New Mexico 26305 1
North Dakota 6839 1
South Carolina 58307 1
South Dakota 7553 1
Tennessee 90311 1
Vermont 7875 1
West Virginia 12285 1
Wyoming 4279 1
Puerto Rico 2930 0
white2010 <- filter(pop2010,variable=="White") %>% arrange(desc(pct)) 
gt(white2010[,c(2,4,6)]) %>%  tab_header(
    title = "White Population _ by percentage",
    subtitle = "2010 Census _ all states"
  )
White Population _ by percentage
2010 Census _ all states
NAME value pct
Maine 1254297 94
Vermont 590223 94
West Virginia 1726256 93
New Hampshire 1215050 92
Iowa 2701123 89
North Dakota 598007 89
Montana 868628 88
Kentucky 3745655 86
Wyoming 483874 86
South Dakota 689502 85
Idaho 1316243 84
Minnesota 4405142 83
Wisconsin 4738411 83
Indiana 5286453 82
Nebraska 1499753 82
Missouri 4850748 81
Ohio 9359263 81
Utah 2221719 80
Pennsylvania 10094652 79
Kansas 2230539 78
Oregon 3005848 78
Michigan 7569939 77
Massachusetts 4984800 76
Rhode Island 803685 76
Tennessee 4800782 76
Arkansas 2173469 75
Washington 4876804 73
Connecticut 2546262 71
Colorado 3520793 70
Oklahoma 2575381 69
Alabama 3204402 67
Delaware 586752 65
North Carolina 6223995 65
Virginia 5186450 65
Alaska 455320 64
Illinois 8167753 64
South Carolina 2962740 64
Louisiana 2734884 60
New Jersey 5214878 59
Arizona 3695647 58
Florida 10884722 58
Mississippi 1722287 58
New York 11304247 58
Georgia 5413920 56
Maryland 3157958 55
Nevada 1462081 54
Texas 11397345 45
California 14956253 40
New Mexico 833810 40
District of Columbia 209464 35
Hawaii 309343 23
Puerto Rico 26946 1
black2010 <- filter(pop2010,variable=="Black") %>% arrange(desc(pct)) 
gt(black2010[,c(2,4,6)]) %>%  tab_header(
    title = "Black Population _ by  percentage",
    subtitle = "2010 Census _ all states"
  )
Black Population _ by percentage
2010 Census _ all states
NAME value pct
District of Columbia 301053 50
Mississippi 1093512 37
Louisiana 1442420 32
Georgia 2910800 30
Maryland 1674229 29
South Carolina 1279998 28
Alabama 1244437 26
Delaware 186782 21
North Carolina 2019854 21
Virginia 1523704 19
Tennessee 1049391 17
Arkansas 447102 15
Florida 2851100 15
Illinois 1832924 14
Michigan 1383756 14
New York 2783857 14
New Jersey 1125401 13
Ohio 1389115 12
Missouri 687149 11
Texas 2886825 11
Pennsylvania 1327091 10
Connecticut 335119 9
Indiana 582140 9
Kentucky 333075 8
Nevada 208058 8
Oklahoma 272071 7
California 2163804 6
Kansas 162700 6
Massachusetts 391693 6
Wisconsin 350898 6
Minnesota 269141 5
Rhode Island 51560 5
Arizona 239101 4
Colorado 188778 4
Nebraska 80959 4
Alaska 21949 3
Iowa 86906 3
Washington 229603 3
West Virginia 62122 3
New Mexico 35462 2
Oregon 64984 2
Hawaii 19904 1
Idaho 8875 1
Maine 15154 1
New Hampshire 13625 1
North Dakota 7720 1
South Dakota 9959 1
Utah 25951 1
Vermont 5943 1
Wyoming 4351 1
Montana 3743 0
Puerto Rico 4663 0
pop2010 <- get_acs(geography = "state",  
                   variables = c(Total="B02001_001", White="B02008_001",Hispanic="B03001_003",Asian="B02011_001", Black="B02009_001"), 
                         year = 2010) %>% arrange(as.numeric(GEOID))          
## Getting data from the 2006-2010 5-year ACS
pop2020 <- get_acs(geography = "state",   
                   variables = c(Total="B02001_001", White="B02008_001",Hispanic="B03001_003",Asian="B02011_001", Black="B02009_001"), 
                         year = 2020) %>%   arrange(as.numeric(GEOID))
## Getting data from the 2016-2020 5-year ACS
pop2020$p2010 <- pop2010$estimate
pop2020$change <- pop2020$estimate - pop2010$estimate

pop2020 <- pop2020[-5]


filter(pop2020,variable=="Total") %>% select(c(2,4,6))  %>% gt() %>%   
  
    tab_header(
    title = md("Total Population Changes"),
    subtitle = md("2020 Census _ Change from 2010")) 
Total Population Changes
2020 Census _ Change from 2010
NAME estimate change
Alabama 4893186 180535
Alaska 736990 45801
Arizona 7174064 927248
Arkansas 3011873 139189
California 39346023 2708733
Colorado 5684926 797865
Connecticut 3570549 24712
Delaware 967679 86401
District of Columbia 701974 117574
Florida 21216924 2705304
Georgia 10516579 1047764
Hawaii 1420074 86483
Idaho 1754367 227570
Illinois 12716164 -29195
Indiana 6696893 279495
Iowa 3150011 133744
Kansas 2912619 103290
Kentucky 4461952 176124
Louisiana 4664616 234676
Maine 1340825 13160
Maryland 6037624 341201
Massachusetts 6873003 395907
Michigan 9973907 21220
Minnesota 5600166 358252
Mississippi 2981835 39844
Missouri 6124160 201846
Montana 1061705 87966
Nebraska 1923826 124701
Nevada 3030281 396950
New Hampshire 1355244 41305
New Jersey 8885418 163841
New Mexico 2097021 83899
New York 19514849 285097
North Carolina 10386227 1115049
North Dakota 760394 100536
Ohio 11675275 162844
Oklahoma 3949342 274003
Oregon 4176346 414421
Pennsylvania 12794885 182180
Rhode Island 1057798 1409
South Carolina 5091517 580089
South Dakota 879336 79874
Tennessee 6772268 537300
Texas 28635442 4323551
Utah 3151239 494003
Vermont 624340 82
Virginia 8509358 667604
Washington 7512465 951168
West Virginia 1807426 -33376
Wisconsin 5806975 169028
Wyoming 581348 35769
Puerto Rico 3255642 -506680
total2020 <- filter(pop2020,variable=="Total") %>% select(c(2,4,6))  
total2020 %>%  group_by(estimate,change) %>% 
  summarise(total = sum(estimate),change=sum(change))
## `summarise()` has grouped output by 'estimate'. You can override using the
## `.groups` argument.
## # A tibble: 52 × 3
## # Groups:   estimate [52]
##    estimate change   total
##       <dbl>  <dbl>   <dbl>
##  1   581348  35769  581348
##  2   624340     82  624340
##  3   701974 117574  701974
##  4   736990  45801  736990
##  5   760394 100536  760394
##  6   879336  79874  879336
##  7   967679  86401  967679
##  8  1057798   1409 1057798
##  9  1061705  87966 1061705
## 10  1340825  13160 1340825
## # … with 42 more rows
#----------------------------------------------------

filter(pop2020,variable=="Asian") %>% select(c(2,4,6)) %>%  arrange(desc(change)) %>% 
    gt() %>%  tab_header(
    title = md("Asian Population Changes"),
    subtitle = md("2020 Census _ Change from 2010")
  )
Asian Population Changes
2020 Census _ Change from 2010
NAME estimate change
California 6764118 1492806
Texas 1656166 651465
New York 1884346 392699
Washington 854617 295163
Florida 763613 232633
Virginia 691449 214694
New Jersey 948998 202836
Illinois 828847 199156
Georgia 515434 184564
Massachusetts 538409 170224
Pennsylvania 532335 161419
North Carolina 377854 150808
Ohio 344131 122999
Maryland 463308 117551
Arizona 326446 116968
Michigan 390937 112322
Minnesota 330738 100768
Nevada 320596 100272
Oregon 258188 84719
Indiana 195087 80378
Colorado 252624 79971
Wisconsin 203052 61742
Tennessee 155558 52661
Connecticut 196347 50453
Missouri 161495 48239
South Carolina 110663 43065
Utah 112368 41744
Hawaii 803266 39678
Iowa 97896 39094
Oklahoma 116701 38282
Kansas 110231 32698
Kentucky 88096 32536
Alabama 89031 27528
Nebraska 62516 25284
Louisiana 99667 22722
Arkansas 59949 20224
Alaska 64669 18026
Idaho 42595 15530
New Hampshire 47713 15474
District of Columbia 37847 14043
Delaware 45744 13962
New Mexico 48942 13623
Rhode Island 45472 10646
Mississippi 39237 10436
North Dakota 16362 8297
South Dakota 16062 6958
West Virginia 20784 6261
Maine 23244 6257
Montana 15622 5952
Vermont 14972 5510
Wyoming 9194 3589
Puerto Rico 8450 -6579
#------------------
filter(pop2020,variable=="Hispanic") %>% select(c(2,4,6))  %>% arrange(desc(change)) %>%
    gt() %>%  tab_header(
    title = md("Hispanic Population Changes"),
    subtitle = md("2020 Census _ Change from 2010")
  )
Hispanic Population Changes
2020 Census _ Change from 2010
NAME estimate change
Texas 11294257 2376780
California 15380929 1924772
Florida 5468826 1473502
Arizona 2260690 446016
New York 3720707 431827
New Jersey 1815078 346902
Pennsylvania 971813 315305
Washington 971522 279974
North Carolina 991051 267643
Illinois 2190696 250768
Colorado 1231126 247800
Massachusetts 828140 243165
Virginia 810770 235804
Georgia 1013057 228345
Nevada 875798 201901
Maryland 619418 189472
Connecticut 587212 140101
Oregon 552279 132084
Oklahoma 431467 129300
Ohio 459939 126920
Utah 446067 119261
New Mexico 1031788 117886
Tennessee 377162 115714
Indiana 475475 114003
Michigan 521203 97791
Wisconsin 408267 97718
South Carolina 296897 88143
Kansas 351602 75494
Minnesota 307675 73959
Louisiana 243372 70618
Missouri 262677 64007
Nebraska 214952 62981
Idaho 222967 61630
Arkansas 229629 61202
Iowa 194407 57475
Kentucky 167949 50601
Alabama 212951 50580
Rhode Island 168007 43575
Hawaii 152566 37133
District of Columbia 77981 26680
Mississippi 94342 24508
Delaware 91350 24435
New Hampshire 52792 17454
North Dakota 30325 17447
South Dakota 36088 15644
Alaska 53059 14666
Montana 41501 14241
Wyoming 58854 13072
West Virginia 28679 7724
Maine 23143 6100
Vermont 12518 3364
Puerto Rico 3212625 -504245
#------------------
filter(pop2020,variable=="White") %>% select(c(2,4,6))  %>% arrange(desc(change)) %>%
  gt() %>%  tab_header(
    title = md("White Population Changes"),
    subtitle = md("2020 Census _ Change from 2010")
  )
White Population Changes
2020 Census _ Change from 2010
NAME estimate change
Texas 21681317 3752456
Florida 16371086 1949076
California 24826054 1280089
North Carolina 7348103 751495
Colorado 4948790 730334
Arizona 5752282 724940
Washington 6007728 564173
Georgia 6353997 447211
South Carolina 3521154 428808
Tennessee 5380206 382181
Utah 2807476 379859
Virginia 6000367 368264
Oregon 3692435 349194
Idaho 1623030 180209
Oklahoma 3129278 166716
Indiana 5718307 145154
New Mexico 1627090 139261
Minnesota 4773429 134983
Massachusetts 5546174 131523
Missouri 5179826 128815
Kentucky 3965298 112071
Louisiana 2968078 98051
Nebraska 1711828 91844
District of Columbia 312609 82845
Kansas 2548409 82839
Arkansas 2382587 80504
Wisconsin 5076630 76424
Montana 970545 75073
Iowa 2894547 73855
North Dakota 674281 67040
Nevada 2080484 66104
Alabama 3411460 64185
South Dakota 762967 56879
Hawaii 604632 49240
Delaware 684795 43408
Illinois 9367474 38033
Wyoming 547044 35121
New Hampshire 1284067 26543
Alaska 529303 16373
Maine 1291593 3872
Michigan 8082811 1088
Maryland 3501814 -477
Vermont 600582 -6180
Rhode Island 877920 -7581
Mississippi 1774378 -13368
Ohio 9776587 -15331
New Jersey 6188854 -23545
West Virginia 1713884 -47098
Connecticut 2799956 -60568
Pennsylvania 10537652 -91106
New York 12894580 -175309
Puerto Rico 2246894 -817277
#------------------
filter(pop2020,variable=="Black") %>% select(c(2,4,6))  %>% arrange(desc(change)) %>%
  gt() %>%  tab_header(
    title = md("Black Population Changes"),
    subtitle = md("2020 Census _ Change from 2010")
  )
Black Population Changes
2020 Census _ Change from 2010
NAME estimate change
Texas 3834846 815111
Florida 3735264 673579
Georgia 3499486 551954
North Carolina 2392742 321041
California 2806900 226228
Maryland 1937445 200333
New York 3396120 195910
Virginia 1800436 184291
Pennsylvania 1634203 174119
Ohio 1673910 164798
Massachusetts 662313 163170
Minnesota 447354 142279
Arizona 425315 139221
Tennessee 1214063 136480
Louisiana 1560682 126802
Washington 425653 121040
South Carolina 1423031 118662
Indiana 735826 103856
Nevada 337681 101492
Alabama 1349127 90795
New Jersey 1335434 76479
Colorado 309449 75913
Connecticut 456214 71342
Kentucky 425351 60888
Missouri 784331 57879
Wisconsin 441868 53336
Iowa 156107 50373
Oklahoma 364516 48995
Mississippi 1149098 46686
Delaware 234353 37683
Oregon 124917 32384
Arkansas 493883 31780
Nebraska 117761 23415
Michigan 1524001 22463
Utah 59239 21078
Kansas 216216 21076
North Dakota 28675 19231
Rhode Island 91539 17572
District of Columbia 333114 17513
West Virginia 84768 13926
Hawaii 51286 13249
South Dakota 25975 13067
New Hampshire 32277 12432
New Mexico 62321 10853
Maine 27832 9347
Idaho 21346 6775
Illinois 1957092 5755
Alaska 37226 4882
Montana 12031 4720
Wyoming 10732 4445
Vermont 12384 3921
Puerto Rico 547012 -21025

U.S. counties with Hispanic Majority ( greater than 50%)

vars20 <- c(Hispanic="P2_002N", Asian="P1_006N",White="P1_003N",Black="P1_004N")


us2020 <- get_decennial(geography = "county", variables = vars20, year = 2020,
                    summary_var = "P1_001N", geometry = F) %>%
                    mutate(pct = round(100 * (value / summary_value),digits = 0))
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
us2020 <- us2020 %>% filter(!str_detect(NAME, regex("\\ Puerto Rico", ignore_case = TRUE)))
us2020$NAME <- gsub(" County","",us2020$NAME)
us2020 <- us2020 %>% separate(NAME,sep = "," , c('County', 'state'))
hispanic2020 <- filter(us2020,variable=="Hispanic") %>%  filter(pct>50) %>% arrange(desc(pct)) 
gt(hispanic2020[,c(2,3,7)]) %>%  tab_header(
    title = "Hispanic Population _ by county percentage",
    subtitle = "2020 Census California"
  )
Hispanic Population _ by county percentage
2020 Census California
County state pct
Starr Texas 98
Webb Texas 95
Maverick Texas 95
Zapata Texas 94
Hidalgo Texas 92
Zavala Texas 92
Cameron Texas 89
Brooks Texas 88
Jim Hogg Texas 88
Dimmit Texas 87
Willacy Texas 87
Imperial California 85
Reeves Texas 85
El Paso Texas 83
Santa Cruz Arizona 83
Duval Texas 81
Presidio Texas 81
Val Verde Texas 80
Jim Wells Texas 79
Mora New Mexico 79
Frio Texas 77
Guadalupe New Mexico 77
Culberson Texas 75
Deaf Smith Texas 75
Kenedy Texas 75
San Miguel New Mexico 75
La Salle Texas 74
Kleberg Texas 71
Pecos Texas 71
Uvalde Texas 70
Miami-Dade Florida 69
Crane Texas 68
Reagan Texas 67
Doña Ana New Mexico 67
Rio Arriba New Mexico 67
Tulare California 66
Bailey Texas 66
Parmer Texas 66
Luna New Mexico 66
Seward Kansas 66
Castro Texas 65
Yoakum Texas 65
Adams Washington 64
Atascosa Texas 64
Hudspeth Texas 64
Yuma Arizona 64
Colusa California 62
Merced California 62
Bee Texas 62
Crockett Texas 62
Sutton Texas 62
San Benito California 61
Ector Texas 61
Nueces Texas 61
Winkler Texas 61
Lea New Mexico 61
Madera California 60
Monterey California 60
Hale Texas 60
Cochran Texas 60
Valencia New Mexico 60
Bexar Texas 59
Moore Texas 59
Kings California 57
Costilla Colorado 57
Floyd Texas 57
Lamb Texas 57
Chaves New Mexico 57
Hidalgo New Mexico 57
Ford Kansas 57
Hendry Florida 56
Garza Texas 56
San Patricio Texas 56
Terry Texas 56
Andrews Texas 56
Caldwell Texas 56
Kern California 55
Bronx New York 55
Crosby Texas 55
Ochiltree Texas 55
Fresno California 54
San Bernardino California 54
Franklin Washington 54
Osceola Florida 54
Dawson Texas 54
Upton Texas 54
Ward Texas 54
Karnes Texas 53
Grant Kansas 53
Dallam Texas 52
Schleicher Texas 52
Finney Kansas 52
Conejos Colorado 51
Yakima Washington 51
Texas Oklahoma 51
Taos New Mexico 51

2010 population data for California counties

vars10 <- c(Hispanic="P005010", Asian="P005006",White="P005003",Black="P005004")


ca2010 <- get_decennial(geography = "county", variables = vars10, year = 2010,
                    summary_var = "P005001", state = "CA", geometry = F) %>%
                    mutate(pct = round(100 * (value / summary_value),digits = 0))
## Getting data from the 2010 decennial Census
## Using Census Summary File 1
ca2010$NAME <- gsub(", California","",ca2010$NAME)

hispanic2010 <- filter(ca2010,variable=="Hispanic") %>% arrange(desc(pct)) 
gt(hispanic2010[,c(2,4,6)]) %>%  tab_header(
    title = "Hispanic Population _ by county percentage",
    subtitle = "2010 Census California"
  )
Hispanic Population _ by county percentage
2010 Census California
NAME value pct
Imperial County 140271 80
Tulare County 268065 61
San Benito County 31186 56
Colusa County 11804 55
Merced County 140485 55
Monterey County 230003 55
Madera County 80992 54
Kings County 77866 51
Fresno County 468070 50
Kern County 413033 49
San Bernardino County 1001145 49
Los Angeles County 4687889 48
Riverside County 995257 45
Santa Barbara County 181687 43
Stanislaus County 215658 42
Ventura County 331567 40
San Joaquin County 266341 39
Glenn County 10539 37
Orange County 1012973 34
Napa County 44010 32
San Diego County 991348 32
Santa Cruz County 84092 32
Yolo County 60953 30
Sutter County 27251 29
Santa Clara County 479210 27
Mono County 3762 26
San Mateo County 182502 25
Yuba County 18051 25
Sonoma County 120430 25
Contra Costa County 255560 24
Solano County 99356 24
Alameda County 339889 23
Mendocino County 19505 22
Sacramento County 306196 22
Tehama County 13906 22
San Luis Obispo County 55973 21
Inyo County 3597 19
Del Norte County 5093 18
Lassen County 6117 18
Lake County 11088 17
Marin County 39069 15
San Francisco County 121774 15
Butte County 31116 14
Modoc County 1342 14
Placer County 44710 13
Amador County 4756 12
El Dorado County 21875 12
Tuolumne County 5918 11
Calaveras County 4703 10
Humboldt County 13211 10
Siskiyou County 4615 10
Mariposa County 1676 9
Nevada County 8439 9
Plumas County 1605 8
Shasta County 14878 8
Sierra County 269 8
Alpine County 84 7
Trinity County 959 7
#-------------------------------------
asian2010 <- filter(ca2010,variable=="Asian") %>% arrange(desc(pct)) 
gt(asian2010[,c(2,4,6)]) %>%  tab_header(
    title = "Asian Population _ by county percentage",
    subtitle = "2010 Census California"
  )
Asian Population _ by county percentage
2010 Census California
NAME value pct
San Francisco County 265700 33
Santa Clara County 565466 32
Alameda County 390524 26
San Mateo County 175934 24
Orange County 532477 18
Contra Costa County 148881 14
Los Angeles County 1325671 14
Sacramento County 198944 14
San Joaquin County 94547 14
Solano County 59027 14
Sutter County 13442 14
Yolo County 25640 13
San Diego County 328058 11
Fresno County 86856 9
Merced County 18183 7
Napa County 8986 7
Yuba County 4710 7
Ventura County 54099 7
Monterey County 23777 6
San Bernardino County 123978 6
Placer County 19963 6
Riverside County 125921 6
Marin County 13577 5
Santa Barbara County 19591 5
Stanislaus County 24712 5
Butte County 8921 4
Kern County 33100 4
Santa Cruz County 10658 4
Sonoma County 17777 4
Del Norte County 938 3
Kings County 5339 3
El Dorado County 6143 3
San Luis Obispo County 8106 3
Tulare County 14204 3
Glenn County 674 2
Humboldt County 2854 2
Madera County 2533 2
Mendocino County 1402 2
San Benito County 1298 2
Shasta County 4297 2
Colusa County 267 1
Alpine County 7 1
Amador County 396 1
Calaveras County 529 1
Imperial County 2201 1
Inyo County 229 1
Mariposa County 201 1
Lake County 695 1
Lassen County 337 1
Modoc County 70 1
Mono County 191 1
Nevada County 1124 1
Plumas County 127 1
Siskiyou County 528 1
Tehama County 625 1
Trinity County 93 1
Tuolumne County 530 1
Sierra County 12 0
white2010 <- filter(ca2010,variable=="White") %>% arrange(desc(pct)) 
gt(white2010[,c(2,4,6)]) %>%  tab_header(
    title = "White Population _ by county percentage",
    subtitle = "2010 Census California"
  )
White Population _ by county percentage
2010 Census California
NAME value pct
Sierra County 2855 88
Nevada County 85477 87
Plumas County 17015 85
Calaveras County 38074 84
Trinity County 11518 84
Mariposa County 15192 83
Shasta County 146044 82
Tuolumne County 45325 82
Amador County 30325 80
El Dorado County 144689 80
Modoc County 7649 79
Siskiyou County 35683 79
Humboldt County 103958 77
Placer County 265294 76
Butte County 165416 75
Lake County 47938 74
Alpine County 852 73
Marin County 183830 73
Tehama County 45603 72
San Luis Obispo County 191696 71
Mendocino County 60249 69
Mono County 9687 68
Lassen County 23270 67
Inyo County 12296 66
Sonoma County 320027 66
Del Norte County 18513 65
Santa Cruz County 156397 60
Yuba County 42416 59
Glenn County 15717 56
Napa County 76967 56
Sutter County 47782 50
Yolo County 100240 50
Ventura County 400868 49
Contra Costa County 500923 48
Sacramento County 687166 48
San Diego County 1500047 48
Santa Barbara County 203122 48
Stanislaus County 240423 47
Orange County 1328499 44
San Francisco County 337451 42
San Mateo County 303609 42
Solano County 168628 41
Colusa County 8524 40
Riverside County 869068 40
Kern County 323794 39
Madera County 57380 38
San Benito County 21154 38
San Joaquin County 245919 36
Kings County 53879 35
Santa Clara County 626909 35
Alameda County 514559 34
Fresno County 304522 33
Monterey County 136435 33
San Bernardino County 677598 33
Tulare County 143935 33
Merced County 81599 32
Los Angeles County 2728321 28
Imperial County 23927 14
black2010 <- filter(ca2010,variable=="Black") %>% arrange(desc(pct)) 
gt(black2010[,c(2,4,6)]) %>%  tab_header(
    title = "Black Population _ by county percentage",
    subtitle = "2010 Census California"
  )
Black Population _ by county percentage
2010 Census California
NAME value pct
Solano County 58743 14
Alameda County 184126 12
Sacramento County 139949 10
Contra Costa County 93604 9
Lassen County 2790 8
Los Angeles County 815086 8
San Bernardino County 170700 8
Kings County 10314 7
San Joaquin County 48540 7
Riverside County 130823 6
San Francisco County 46781 6
Fresno County 45005 5
Kern County 45377 5
San Diego County 146600 5
Del Norte County 967 3
Imperial County 5114 3
Madera County 5009 3
Marin County 6621 3
Merced County 8785 3
Monterey County 11300 3
San Mateo County 18763 3
Yuba County 2122 3
Stanislaus County 13065 3
Amador County 938 2
Lake County 1186 2
Napa County 2440 2
San Luis Obispo County 5128 2
Santa Barbara County 7242 2
Santa Clara County 42331 2
Sutter County 1713 2
Ventura County 13082 2
Yolo County 4752 2
Tuolumne County 1114 2
Colusa County 168 1
Butte County 3133 1
Calaveras County 355 1
Glenn County 192 1
Humboldt County 1393 1
El Dorado County 1296 1
Inyo County 102 1
Mariposa County 129 1
Orange County 44000 1
Mendocino County 544 1
Modoc County 77 1
San Benito County 355 1
Placer County 4427 1
Plumas County 181 1
Siskiyou County 552 1
Santa Cruz County 2304 1
Shasta County 1438 1
Sonoma County 6769 1
Tehama County 349 1
Tulare County 5497 1
Alpine County 0 0
Mono County 42 0
Nevada County 341 0
Sierra County 5 0
Trinity County 45 0

2020 population data for CA counties

vars20 <- c(Hispanic="P2_002N", Asian="P1_006N",White="P1_003N",Black="P1_004N")


ca2020 <- get_decennial(geography = "county", variables = vars20, year = 2020,
                    summary_var = "P1_001N", state = "CA", geometry = F) %>%
                    mutate(pct = round(100 * (value / summary_value),digits = 0))
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
ca2020$NAME <- gsub(", California","",ca2020$NAME)

hispanic2020 <- filter(ca2020,variable=="Hispanic") %>% arrange(desc(pct)) 
gt(hispanic2020[,c(2,4,6)]) %>%  tab_header(
    title = "Hispanic Population _ by county percentage",
    subtitle = "2020 Census California"
  )
Hispanic Population _ by county percentage
2020 Census California
NAME value pct
Imperial County 153027 85
Tulare County 309895 66
Colusa County 13476 62
Merced County 173857 62
San Benito County 39241 61
Madera County 93178 60
Monterey County 265321 60
Kings County 86607 57
Kern County 499158 55
Fresno County 540743 54
San Bernardino County 1170913 54
Riverside County 1202295 50
Los Angeles County 4804763 48
Stanislaus County 265978 48
Santa Barbara County 210584 47
Glenn County 12541 43
Ventura County 365285 43
San Joaquin County 325725 42
Napa County 48829 35
Santa Cruz County 94299 35
Orange County 1086834 34
San Diego County 1119629 34
Yolo County 71700 33
Sutter County 31568 32
Sonoma County 141438 29
Yuba County 23520 29
Solano County 128155 28
Contra Costa County 314900 27
Tehama County 17938 27
Mono County 3507 27
Mendocino County 23933 26
San Mateo County 191386 25
Santa Clara County 487357 25
Sacramento County 374434 24
San Luis Obispo County 67921 24
Alameda County 393749 23
Lassen County 7531 23
Inyo County 4399 23
Lake County 15442 23
Butte County 40112 19
Marin County 49410 19
Del Norte County 5321 19
San Francisco County 136761 16
Placer County 60628 15
Amador County 6014 15
El Dorado County 26459 14
Humboldt County 18535 14
Modoc County 1259 14
Tuolumne County 7124 13
Calaveras County 5865 13
Siskiyou County 5527 13
Mariposa County 2140 12
Sierra County 377 12
Shasta County 19730 11
Nevada County 10416 10
Plumas County 1897 10
Alpine County 84 7
Trinity County 937 6
hispanic2020 <- filter(ca2020,variable=="Hispanic") %>% arrange(desc(value)) 
gt(hispanic2020[,c(2,4,6)]) %>%  tab_header(
    title = "Hispanic Population _ by population",
    subtitle = "2020 Census California"
  )
Hispanic Population _ by population
2020 Census California
NAME value pct
Los Angeles County 4804763 48
Riverside County 1202295 50
San Bernardino County 1170913 54
San Diego County 1119629 34
Orange County 1086834 34
Fresno County 540743 54
Kern County 499158 55
Santa Clara County 487357 25
Alameda County 393749 23
Sacramento County 374434 24
Ventura County 365285 43
San Joaquin County 325725 42
Contra Costa County 314900 27
Tulare County 309895 66
Stanislaus County 265978 48
Monterey County 265321 60
Santa Barbara County 210584 47
San Mateo County 191386 25
Merced County 173857 62
Imperial County 153027 85
Sonoma County 141438 29
San Francisco County 136761 16
Solano County 128155 28
Santa Cruz County 94299 35
Madera County 93178 60
Kings County 86607 57
Yolo County 71700 33
San Luis Obispo County 67921 24
Placer County 60628 15
Marin County 49410 19
Napa County 48829 35
Butte County 40112 19
San Benito County 39241 61
Sutter County 31568 32
El Dorado County 26459 14
Mendocino County 23933 26
Yuba County 23520 29
Shasta County 19730 11
Humboldt County 18535 14
Tehama County 17938 27
Lake County 15442 23
Colusa County 13476 62
Glenn County 12541 43
Nevada County 10416 10
Lassen County 7531 23
Tuolumne County 7124 13
Amador County 6014 15
Calaveras County 5865 13
Siskiyou County 5527 13
Del Norte County 5321 19
Inyo County 4399 23
Mono County 3507 27
Mariposa County 2140 12
Plumas County 1897 10
Modoc County 1259 14
Trinity County 937 6
Sierra County 377 12
Alpine County 84 7
#-----------------------
             
asian2020 <- filter(ca2020,variable=="Asian") %>% arrange(desc(pct)) 
gt(asian2020[,c(2,4,6)]) %>%  tab_header(
    title = "Asian Population _ by county percentage",
    subtitle = "2020 Census California"
  )
Asian Population _ by county percentage
2020 Census California
NAME value pct
Santa Clara County 759030 39
San Francisco County 296505 34
Alameda County 545261 32
San Mateo County 230242 30
Orange County 706813 22
Contra Costa County 217823 19
Sacramento County 281733 18
San Joaquin County 139323 18
Sutter County 18234 18
Solano County 72766 16
Los Angeles County 1499984 15
Yolo County 30392 14
Trinity County 2222 14
San Diego County 410752 12
Fresno County 113328 11
Placer County 35500 9
Napa County 10753 8
San Bernardino County 182287 8
Ventura County 64923 8
Merced County 20715 7
Riverside County 171243 7
Yuba County 5774 7
Marin County 16431 6
Monterey County 26680 6
Santa Barbara County 26549 6
Stanislaus County 34778 6
Butte County 10533 5
El Dorado County 9200 5
Kern County 46777 5
Santa Cruz County 12553 5
Sonoma County 22845 5
Kings County 5923 4
San Benito County 2423 4
San Luis Obispo County 10402 4
Tulare County 17194 4
Humboldt County 3615 3
Madera County 3907 3
Del Norte County 840 3
Shasta County 5978 3
Imperial County 3049 2
Lassen County 494 2
Mariposa County 298 2
Mendocino County 1788 2
Tehama County 1027 2
Calaveras County 743 2
Glenn County 647 2
Siskiyou County 888 2
Alpine County 12 1
Colusa County 276 1
Modoc County 61 1
Nevada County 1427 1
Plumas County 152 1
Tuolumne County 816 1
Mono County 163 1
Amador County 582 1
Inyo County 282 1
Lake County 1004 1
Sierra County 7 0
white2020 <- filter(ca2020,variable=="White") %>% arrange(desc(pct)) 
gt(white2020[,c(2,4)]) %>%  tab_header(
    title = "White Population _ by county percentage",
    subtitle = "2020 Census California"
  )
White Population _ by county percentage
2020 Census California
NAME value
Nevada County 85604
Plumas County 16608
Sierra County 2703
Calaveras County 36315
Tuolumne County 44207
Mariposa County 13385
Modoc County 6772
Shasta County 142899
El Dorado County 146624
Amador County 31104
Siskiyou County 33597
Humboldt County 98095
Trinity County 11627
Butte County 149557
Placer County 288586
Mono County 9349
San Luis Obispo County 198338
Lake County 46858
Alpine County 814
Marin County 179377
Tehama County 44926
Mendocino County 59510
Lassen County 21066
Sonoma County 306684
Del Norte County 17193
Inyo County 11752
Santa Cruz County 160565
Yuba County 46590
Napa County 76158
Glenn County 15753
Ventura County 428677
San Diego County 1633129
Yolo County 107304
Santa Barbara County 224748
Sutter County 46810
Stanislaus County 256602
Sacramento County 715722
Colusa County 9364
Contra Costa County 501697
Orange County 1383257
Madera County 65248
San Benito County 27230
Kern County 371734
Riverside County 995627
San Francisco County 361382
Kings County 61226
San Mateo County 300188
Solano County 175768
Tulare County 186255
Fresno County 374678
Merced County 104534
Monterey County 158879
San Bernardino County 782691
San Joaquin County 267339
Los Angeles County 3259427
Santa Clara County 622617
Alameda County 523836
Imperial County 47537
black2020 <- filter(ca2020,variable=="Black") %>% arrange(desc(pct)) 
gt(black2020[,c(2,4,6)]) %>%  tab_header(
    title = "Black Population _ by county percentage",
    subtitle = "2020 Census California"
  )
Black Population _ by county percentage
2020 Census California
NAME value pct
Solano County 62157 14
Alameda County 164879 10
Sacramento County 152795 10
Contra Costa County 101485 9
San Bernardino County 184558 8
San Joaquin County 60351 8
Los Angeles County 794364 8
Lassen County 2277 7
Kern County 50130 6
Kings County 9023 6
Riverside County 156477 6
Fresno County 48707 5
San Diego County 155813 5
San Francisco County 46725 5
Yuba County 3052 4
Madera County 4596 3
Merced County 9158 3
Yolo County 6164 3
Amador County 1236 3
Del Norte County 855 3
Stanislaus County 15913 3
Butte County 3644 2
Imperial County 4362 2
Marin County 6339 2
Monterey County 9943 2
Napa County 2443 2
Orange County 53842 2
Placer County 6890 2
San Luis Obispo County 4610 2
San Mateo County 15707 2
Santa Clara County 44966 2
Sonoma County 7615 2
Sutter County 1982 2
Tuolumne County 1009 2
Lake County 1199 2
Santa Barbara County 7374 2
Ventura County 15330 2
Alpine County 10 1
Colusa County 198 1
El Dorado County 1537 1
Humboldt County 1879 1
Mariposa County 108 1
Mendocino County 642 1
Modoc County 67 1
Plumas County 103 1
San Benito County 634 1
Santa Cruz County 3150 1
Tehama County 420 1
Tulare County 6668 1
Mono County 74 1
Calaveras County 364 1
Glenn County 177 1
Inyo County 97 1
Shasta County 1912 1
Siskiyou County 496 1
Nevada County 460 0
Sierra County 7 0
Trinity County 71 0

Population shifts by county

a2020 <- arrange(asian2020,as.numeric(GEOID)) 
h2020 <- arrange(hispanic2020,as.numeric(GEOID)) 
w2020 <- arrange(white2020,as.numeric(GEOID)) 
b2020 <- arrange(black2020,as.numeric(GEOID)) 
#--------------------------
a2010 <- arrange(asian2010,as.numeric(GEOID)) 
h2010 <- arrange(hispanic2010,as.numeric(GEOID)) 
w2010 <- arrange(white2010,as.numeric(GEOID)) 
b2010 <- arrange(black2010,as.numeric(GEOID)) 
#--------------------------

a_change <- a2010[,c(1:2,4)]

a_change$year2020 <- a2020$value
colnames(a_change) <- c("GEOID","County","Y2010","Y2020")
a_change$change <- round( 100 * (a_change$Y2020 - a_change$Y2010)/a_change$Y2010,digits=0)
a_change <- a_change %>% filter(Y2010 >1000 ) %>% arrange(desc(change))

a_change[-1] %>% kbl(caption = "Asian Population Trends\n, cities with more than 1000 population") %>% kable_styling(latex_options = "center_position")
Asian Population Trends , cities with more than 1000 population
County Y2010 Y2020 change
San Benito County 1298 2423 87
Placer County 19963 35500 78
Madera County 2533 3907 54
El Dorado County 6143 9200 50
San Bernardino County 123978 182287 47
San Joaquin County 94547 139323 47
Contra Costa County 148881 217823 46
Sacramento County 198944 281733 42
Kern County 33100 46777 41
Stanislaus County 24712 34778 41
Alameda County 390524 545261 40
Imperial County 2201 3049 39
Shasta County 4297 5978 39
Riverside County 125921 171243 36
Santa Barbara County 19591 26549 36
Sutter County 13442 18234 36
Santa Clara County 565466 759030 34
Orange County 532477 706813 33
San Mateo County 175934 230242 31
Fresno County 86856 113328 30
Sonoma County 17777 22845 29
Mendocino County 1402 1788 28
San Luis Obispo County 8106 10402 28
Humboldt County 2854 3615 27
Nevada County 1124 1427 27
San Diego County 328058 410752 25
Solano County 59027 72766 23
Yuba County 4710 5774 23
Marin County 13577 16431 21
Tulare County 14204 17194 21
Napa County 8986 10753 20
Ventura County 54099 64923 20
Yolo County 25640 30392 19
Butte County 8921 10533 18
Santa Cruz County 10658 12553 18
Merced County 18183 20715 14
Los Angeles County 1325671 1499984 13
Monterey County 23777 26680 12
San Francisco County 265700 296505 12
Kings County 5339 5923 11
#---------------------------
h_change <- h2010[,c(1:2,4)]
h_change$y2020 <- h2020$value
colnames(h_change) <- c("GEOID","County","Y2010","Y2020")
h_change$change <- round(100 * (h_change$Y2020 - h_change$Y2010)/h_change$Y2010, digits = 0)
h_change <- h_change %>% filter(Y2010 >1000 )%>% arrange(desc(change))
h_change[-1] %>% kbl(caption = "Hispanic Population Trends\n, cities with more than 1000 population") %>% kable_styling(latex_options = "center_position")
Hispanic Population Trends , cities with more than 1000 population
County Y2010 Y2020 change
Humboldt County 13211 18535 40
Lake County 11088 15442 39
Placer County 44710 60628 36
Shasta County 14878 19730 33
Yuba County 18051 23520 30
Butte County 31116 40112 29
Solano County 99356 128155 29
Tehama County 13906 17938 29
Mariposa County 1676 2140 28
Amador County 4756 6014 26
Marin County 39069 49410 26
San Benito County 31186 39241 26
Calaveras County 4703 5865 25
Merced County 140485 173857 24
Contra Costa County 255560 314900 23
Lassen County 6117 7531 23
Mendocino County 19505 23933 23
Nevada County 8439 10416 23
Stanislaus County 215658 265978 23
Inyo County 3597 4399 22
Sacramento County 306196 374434 22
San Joaquin County 266341 325725 22
El Dorado County 21875 26459 21
Kern County 413033 499158 21
Riverside County 995257 1202295 21
San Luis Obispo County 55973 67921 21
Siskiyou County 4615 5527 20
Tuolumne County 5918 7124 20
Glenn County 10539 12541 19
Plumas County 1605 1897 18
Yolo County 60953 71700 18
San Bernardino County 1001145 1170913 17
Sonoma County 120430 141438 17
Alameda County 339889 393749 16
Fresno County 468070 540743 16
Santa Barbara County 181687 210584 16
Sutter County 27251 31568 16
Tulare County 268065 309895 16
Madera County 80992 93178 15
Monterey County 230003 265321 15
Colusa County 11804 13476 14
San Diego County 991348 1119629 13
San Francisco County 121774 136761 12
Santa Cruz County 84092 94299 12
Kings County 77866 86607 11
Napa County 44010 48829 11
Ventura County 331567 365285 10
Imperial County 140271 153027 9
Orange County 1012973 1086834 7
San Mateo County 182502 191386 5
Del Norte County 5093 5321 4
Los Angeles County 4687889 4804763 2
Santa Clara County 479210 487357 2
Modoc County 1342 1259 -6
Mono County 3762 3507 -7
#----------------------------
w_change <- w2010[,c(1:2,4)]
w_change$year2020 <- w2020$value
colnames(w_change) <- c("GEOID","County","Y2010","Y2020")
w_change$change <- round(  100 * (w_change$Y2020 - w_change$Y2010)/w_change$Y2010, digits = 0)
w_change <- w_change %>% filter(Y2010 >1000 )%>% arrange(desc(change))
w_change[-1] %>% kbl(caption = "White Population Trends\n, cities with more than 1000 population") %>% kable_styling(latex_options = "center_position")
White Population Trends , cities with more than 1000 population
County Y2010 Y2020 change
Imperial County 23927 47537 99
San Benito County 21154 27230 29
Tulare County 143935 186255 29
Merced County 81599 104534 28
Fresno County 304522 374678 23
Los Angeles County 2728321 3259427 19
Monterey County 136435 158879 16
San Bernardino County 677598 782691 16
Kern County 323794 371734 15
Riverside County 869068 995627 15
Kings County 53879 61226 14
Madera County 57380 65248 14
Santa Barbara County 203122 224748 11
Colusa County 8524 9364 10
Yuba County 42416 46590 10
Placer County 265294 288586 9
San Diego County 1500047 1633129 9
San Joaquin County 245919 267339 9
San Francisco County 337451 361382 7
Stanislaus County 240423 256602 7
Ventura County 400868 428677 7
Yolo County 100240 107304 7
Orange County 1328499 1383257 4
Sacramento County 687166 715722 4
Solano County 168628 175768 4
Amador County 30325 31104 3
San Luis Obispo County 191696 198338 3
Santa Cruz County 156397 160565 3
Alameda County 514559 523836 2
El Dorado County 144689 146624 1
Trinity County 11518 11627 1
Contra Costa County 500923 501697 0
Glenn County 15717 15753 0
Nevada County 85477 85604 0
Mendocino County 60249 59510 -1
Napa County 76967 76158 -1
San Mateo County 303609 300188 -1
Santa Clara County 626909 622617 -1
Tehama County 45603 44926 -1
Lake County 47938 46858 -2
Marin County 183830 179377 -2
Plumas County 17015 16608 -2
Shasta County 146044 142899 -2
Sutter County 47782 46810 -2
Tuolumne County 45325 44207 -2
Mono County 9687 9349 -3
Inyo County 12296 11752 -4
Sonoma County 320027 306684 -4
Calaveras County 38074 36315 -5
Sierra County 2855 2703 -5
Humboldt County 103958 98095 -6
Siskiyou County 35683 33597 -6
Del Norte County 18513 17193 -7
Lassen County 23270 21066 -9
Butte County 165416 149557 -10
Modoc County 7649 6772 -11
Mariposa County 15192 13385 -12
#----------------------------
b_change <- b2010[,c(1:2,4)]
b_change$year2020 <- b2020$value
b_change$change <- round(100 * (b_change$year2020 - b_change$value)/b_change$year2020, digits = 0)
colnames(b_change) <- c("GEOID","County","Y2010","Y2020","Change")
b_change <- b_change %>% filter(Y2010 >1000 )%>% arrange(desc(Change))
b_change[-1] %>% kbl(caption = "Black Population Trends\n, cities with more than 1000 population") %>% kable_styling(latex_options = "center_position")
Black Population Trends , cities with more than 1000 population
County Y2010 Y2020 Change
Placer County 4427 6890 36
Yuba County 2122 3052 30
Santa Cruz County 2304 3150 27
Humboldt County 1393 1879 26
Shasta County 1438 1912 25
Yolo County 4752 6164 23
San Joaquin County 48540 60351 20
Orange County 44000 53842 18
Stanislaus County 13065 15913 18
Tulare County 5497 6668 18
El Dorado County 1296 1537 16
Riverside County 130823 156477 16
Ventura County 13082 15330 15
Butte County 3133 3644 14
Sutter County 1713 1982 14
Sonoma County 6769 7615 11
Kern County 45377 50130 9
Contra Costa County 93604 101485 8
Fresno County 45005 48707 8
Sacramento County 139949 152795 8
San Bernardino County 170700 184558 8
San Diego County 146600 155813 6
Santa Clara County 42331 44966 6
Solano County 58743 62157 5
Merced County 8785 9158 4
Santa Barbara County 7242 7374 2
Lake County 1186 1199 1
Napa County 2440 2443 0
San Francisco County 46781 46725 0
Los Angeles County 815086 794364 -3
Marin County 6621 6339 -4
Madera County 5009 4596 -9
Tuolumne County 1114 1009 -10
San Luis Obispo County 5128 4610 -11
Alameda County 184126 164879 -12
Kings County 10314 9023 -14
Monterey County 11300 9943 -14
Imperial County 5114 4362 -17
San Mateo County 18763 15707 -19
Lassen County 2790 2277 -23
racevars <- c(White = "P2_005N", 
              Black = "P2_006N", 
              Asian = "P2_008N", 
              Hispanic = "P2_002N")
ca <- get_decennial(
  geography = "county",
  variables = racevars,
  state = "06",
  geometry = TRUE,
  summary_var = "P2_001N",
  year = 2020
) 
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
ca %>% filter(variable=="Hispanic") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "Hispanic % of population\nCalifornia County\n(2020 Census )")

ca %>% filter(variable=="White") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "White % of population\nCalifornia county\n(2020 Census )")

ca %>% filter(variable=="Asian") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "Asian % of population\nCalifornia County\n(2020 Census)")

racevars <- c(White = "P2_005N", 
              Black = "P2_006N", 
              Asian = "P2_008N", 
              Hispanic = "P2_002N")

oc <- get_decennial(
  geography = "tract",
  variables = racevars,
  state = "06",
  county = "059",
  geometry = TRUE,
  summary_var = "P2_001N",
  year = 2020
) 
## Getting data from the 2020 decennial Census
## Using the PL 94-171 Redistricting Data summary file
oc %>% filter(variable=="Hispanic") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "Hispanic % of population\nOrange County, CA\n(2020 Census tracts)")

oc %>% filter(variable=="White") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "White % of population\nOrange County, CA\n(2020 Census tracts)")

oc %>% filter(variable=="Asian") %>%
  mutate(percent = 100 * (value / summary_value)) %>%
  ggplot(aes(fill = percent)) +
  
  geom_sf(color = "white") +
  theme_void() + 
  scale_fill_viridis_c() + 
  labs(fill = "Asian % of population\nOrange County, CA\n(2020 Census tracts)")