Relational Data & Factors

Thursday, October 17

Today we will…

  • Lab 3 & Challenge 3
    • Common Themes
    • Package Lifecycle Stages
    • Expectations for Tools Used
    • Reminder about Lab 3 Peer Review
  • New Material
    • Relational Data
    • Filtering Joins (PA 4 Review)
    • Factors with forcats
  • Lab 4

Lab 3 Common Themes

  • Q1: The tidyverse package automatically loads ggplot2, dplyr, readr, etc. – do not load these twice!

  • Q3: Where did these data come from? How were they collected? What is the context of these data?

    • Challenge 3: When reaching a conclusion with the hypothesis test, what does Question 3 refer to?
  • Saving an f*$# load of objects

    • Not outputting the results

Lab 3 Common Themes

  • Q5 & Q7: Not using the “correct” function syntax
if_any(.cols = everything(), .fns = ~ is.na(.x))
  • Not using .x to specify where the .cols input should go will go awry when there are multiple function inputs.
  • Using named arguments (e.g., .cols =) makes your code more readable and is part of the code formatting guidelines for this class.

Lab 3 Common Themes

  • Think about “efficient” ways to do things
    • Q5: Are you using the same function across() multiple columns?
    • Q6: Can you calculate multiple summary statistics in one pipeline?
    • Q10-12: Is there a way you can get both the max and min in one pipeline?

Function Lifecycle Stages

PE-4: I can use modern tools when carrying out my analysis.

Function Lifceycle Stages

As packages get updated, the functions and function arguments included in those packages will change.

  • The accepted syntax for a function may change.
  • A function/functionality may disappear.
The image shows a flow diagram representing the lifecycle stages of a feature or process. It consists of four colored boxes with arrows connecting them. The green box in the center labeled stable is the main stage. To the left, an orange box labeled experimental has an arrow pointing toward stable, indicating that experimental features can progress to become stable. From stable, one arrow points upward to another orange box labeled deprecated, indicating that stable features can become deprecated. Another arrow points right to a dark blue box labeled superseded, showing that stable features can also be replaced or superseded.

Learn more about lifecycle stages of packages, functions, function arguments in R.

Lifceycle Stages

The image shows the documentation for the percent() and percent_format() functions in R, from the scales package for modifying the scales of data visualizations. At the top of the documentation it states that this function is superseded. The description states that these functions have been replaced by the label_percent() function.

Deprecated Functions

A deprecated functionality has a better alternative available and is scheduled for removal.

  • You get a warning telling you what to use instead.
military_clean |> 
  filter(across(.cols = -Country, 
                .fns = ~ is.na(.x)
                )
         ) 
Warning: Using `across()` in `filter()` was deprecated in dplyr 1.0.8.
ℹ Please use `if_any()` or `if_all()` instead.
# A tibble: 4 × 35
  Country       Notes `Reporting year` `1988` `1989` `1990` `1991` `1992` `1993`
  <chr>         <chr> <chr>             <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
1 Sub-Saharan   <NA>  <NA>                 NA     NA     NA     NA     NA     NA
2 Central Amer… <NA>  <NA>                 NA     NA     NA     NA     NA     NA
3 Asia & Ocean… <NA>  <NA>                 NA     NA     NA     NA     NA     NA
4 Middle East   <NA>  <NA>                 NA     NA     NA     NA     NA     NA
# ℹ 26 more variables: `1994` <dbl>, `1995` <dbl>, `1996` <dbl>, `1997` <dbl>,
#   `1998` <dbl>, `1999` <dbl>, `2000` <dbl>, `2001` <dbl>, `2002` <dbl>,
#   `2003` <dbl>, `2004` <dbl>, `2005` <dbl>, `2006` <dbl>, `2007` <dbl>,
#   `2008` <dbl>, `2009` <dbl>, `2010` <dbl>, `2011` <dbl>, `2012` <dbl>,
#   `2013` <dbl>, `2014` <dbl>, `2015` <dbl>, `2016` <dbl>, `2017` <dbl>,
#   `2018` <dbl>, `2019` <dbl>

Deprecated Functions

You should not use deprecated functions!

Instead, we use…

military_clean |>
  filter(if_all(.cols = -Country, 
                .fns = ~ is.na(.x)
                )
         ) 
# A tibble: 4 × 35
  Country       Notes `Reporting year` `1988` `1989` `1990` `1991` `1992` `1993`
  <chr>         <chr> <chr>             <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
1 Sub-Saharan   <NA>  <NA>                 NA     NA     NA     NA     NA     NA
2 Central Amer… <NA>  <NA>                 NA     NA     NA     NA     NA     NA
3 Asia & Ocean… <NA>  <NA>                 NA     NA     NA     NA     NA     NA
4 Middle East   <NA>  <NA>                 NA     NA     NA     NA     NA     NA
# ℹ 26 more variables: `1994` <dbl>, `1995` <dbl>, `1996` <dbl>, `1997` <dbl>,
#   `1998` <dbl>, `1999` <dbl>, `2000` <dbl>, `2001` <dbl>, `2002` <dbl>,
#   `2003` <dbl>, `2004` <dbl>, `2005` <dbl>, `2006` <dbl>, `2007` <dbl>,
#   `2008` <dbl>, `2009` <dbl>, `2010` <dbl>, `2011` <dbl>, `2012` <dbl>,
#   `2013` <dbl>, `2014` <dbl>, `2015` <dbl>, `2016` <dbl>, `2017` <dbl>,
#   `2018` <dbl>, `2019` <dbl>

Superceded Functions

A superseded functionality has a better alternative, but is not going away.

  • This is a softer alternative to deprecation.
  • A superseded function will not give a warning (since there’s no risk if you keep using it), but the documentation will give you a recommendation for what to use instead.

What is my job?


Teaching you stuff


(Thoughtfully) choosing what to teach and how to teach it.

Assessing what you’ve learned


What do you understand about the tools I’ve taught you?

This is not the same as assessing if you figured out a way to accomplish a given task.

Don’t Forget to Complete Your Lab 3 Code Review

Make sure your feedback follows the code review guidelines.

Insert your review into the comment box!

Relational Data

When we work with multiple tables of data, we say we are working with relational data.

  • It is the relations, not just the individual datasets, that are important.

When we work with relational data, we rely on keys.

  • A key uniquely identifies an observation in a dataset.
  • A key allows us to relate datasets to each other

Childcare Costs

A figure showing the relations between three different datasets: childcare_costs, counties, and ca_tax_revenue. The childcare_costs dataset has an arrow connecting the variable 'county_fips_code' to the 'county_fips' in the counties dataset. The counties dataset has an arrow connecting the 'county name' variable to the 'entity name' variable in the ca_tax_revenue dataset. Each of the arrows represents the keys (variables) that link each dataset.

Do counties with higher property taxes also have higher childcare costs? Has this relationship changed over time?

Mutating Joins

Add variables from a new dataframe to observations in an existing dataframe.

inner_join()

left_join()

right_join()

full_join()

inner_join()

Keeps observations when their keys are present in both datasets.

This image shows two tables on the left, labeled 'x' and 'y.' The 'x' table contains two columns: a key column with values 1, 2, and 3, and a value column with 'x1,' 'x2,' and 'x3.' The 'y' table also has two columns: a key column with values 1, 2, and 4, and a value column with 'y1,' 'y2,' and 'y3.'

This table combines data from both 'x' and 'y.' based on the 'key' column. It contains three columns: 'key,' 'val_x,' and 'val_y.' For key values 1 and 2, the corresponding values from both 'x' and 'y' are shown ('x1' with 'y1' and 'x2' with 'y2'), while the third rows from both original tables are excluded due to the mismatch in key values.

inner_join(): Childcare Data

Keeps observations when their keys are present in both datasets.

inner_join(x = counties, 
           y = ca_tax_rev, 
           by = join_by(county_name == entity_name)
           )

Keys with different names

The “key” columns linking the counties and ca_tax_rev datasets have different names. So, we need to use the join_by() function to link the names together! Notice, county_name is the column from the x dataset (counties) and entity_name is the column from the y dataset (ca_tax_rev). Order matters!

inner_join(): Childcare Data

Keeps observations when their keys are present in both datasets.

inner_join(x = counties, 
           y = ca_tax_rev, 
           by = join_by(county_name == entity_name)
           )

What counties will remain in the joined dataset?

Autauga County, Baldwin County, Barbour County, Nevada County, Santa Cruz County, …

More Mutating Joins

  • left_join() – keeps only (and all) observations present in the left data set

  • right_join() – keeps only (and all) observations present in the right data set

  • full_join() – keeps all observations present in both data sets

Four Venn diagrams illustrating different types of joins between two datasets, labeled 'x' and 'y.' inner_join(x, y): Shows two overlapping circles with only the intersection shaded, representing records that are common to both 'x' and 'y.' left_join(x, y): Shows two overlapping circles with the left circle ('x') fully shaded and the intersection shaded, representing all records from 'x' and the matching records from 'y.' right_join(x, y): Shows two overlapping circles with the right circle ('y') fully shaded and the intersection shaded, representing all records from 'y' and the matching records from 'x.' full_join(x, y): Shows two overlapping circles with both circles fully shaded, representing all records from both 'x' and 'y,' including those without matches.

More Mutating Joins

Which counties would remain for each of the following joins?

left_join(x = counties, 
          y = ca_tax_rev, 
          by = join_by(county_name == entity_name)
          )
          
right_join(x = counties, 
           y = ca_tax_rev, 
           by = join_by(county_name == entity_name)
           )

full_join(x = counties, 
          y = ca_tax_rev, 
          by = join_by(county_name == entity_name)
          )

Checking Your Intuition

counties |> 
  distinct(county_name)
county_name
Autauga County
Baldwin County
Barbour County
Bibb County
Blount County
Bullock County
Butler County
Calhoun County
Chambers County
Cherokee County
Chilton County
Choctaw County
Clarke County
Clay County
Cleburne County
Coffee County
Colbert County
Conecuh County
Coosa County
Covington County
Crenshaw County
Cullman County
Dale County
Dallas County
DeKalb County
Elmore County
Escambia County
Etowah County
Fayette County
Franklin County
Geneva County
Greene County
Hale County
Henry County
Houston County
Jackson County
Jefferson County
Lamar County
Lauderdale County
Lawrence County
Lee County
Limestone County
Lowndes County
Macon County
Madison County
Marengo County
Marion County
Marshall County
Mobile County
Monroe County
Montgomery County
Morgan County
Perry County
Pickens County
Pike County
Randolph County
Russell County
St. Clair County
Shelby County
Sumter County
Talladega County
Tallapoosa County
Tuscaloosa County
Walker County
Washington County
Wilcox County
Winston County
Aleutians East Borough
Aleutians West Census Area
Anchorage Municipality
Bethel Census Area
Bristol Bay Borough
Denali Borough
Dillingham Census Area
Fairbanks North Star Borough
Haines Borough
Hoonah-Angoon Census Area
Juneau City and Borough
Kenai Peninsula Borough
Ketchikan Gateway Borough
Kodiak Island Borough
Kusilvak Census Area
Lake and Peninsula Borough
Matanuska-Susitna Borough
Nome Census Area
North Slope Borough
Northwest Arctic Borough
Petersburg Borough
Prince of Wales-Hyder Census Area
Sitka City and Borough
Skagway Municipality
Southeast Fairbanks Census Area
Valdez-Cordova Census Area
Wrangell City and Borough
Wrangell-Petersburg Census Area
Yakutat City and Borough
Yukon-Koyukuk Census Area
Apache County
Cochise County
Coconino County
Gila County
Graham County
Greenlee County
La Paz County
Maricopa County
Mohave County
Navajo County
Pima County
Pinal County
Santa Cruz County
Yavapai County
Yuma County
Arkansas County
Ashley County
Baxter County
Benton County
Boone County
Bradley County
Carroll County
Chicot County
Clark County
Cleveland County
Columbia County
Conway County
Craighead County
Crawford County
Crittenden County
Cross County
Desha County
Drew County
Faulkner County
Fulton County
Garland County
Grant County
Hempstead County
Hot Spring County
Howard County
Independence County
Izard County
Johnson County
Lafayette County
Lincoln County
Little River County
Logan County
Lonoke County
Miller County
Mississippi County
Nevada County
Newton County
Ouachita County
Phillips County
Poinsett County
Polk County
Pope County
Prairie County
Pulaski County
St. Francis County
Saline County
Scott County
Searcy County
Sebastian County
Sevier County
Sharp County
Stone County
Union County
Van Buren County
White County
Woodruff County
Yell County
Alameda County
Alpine County
Amador County
Butte County
Calaveras County
Colusa County
Contra Costa County
Del Norte County
El Dorado County
Fresno County
Glenn County
Humboldt County
Imperial County
Inyo County
Kern County
Kings County
Lake County
Lassen County
Los Angeles County
Madera County
Marin County
Mariposa County
Mendocino County
Merced County
Modoc County
Mono County
Monterey County
Napa County
Orange County
Placer County
Plumas County
Riverside County
Sacramento County
San Benito County
San Bernardino County
San Diego County
San Francisco County
San Joaquin County
San Luis Obispo County
San Mateo County
Santa Barbara County
Santa Clara County
Shasta County
Sierra County
Siskiyou County
Solano County
Sonoma County
Stanislaus County
Sutter County
Tehama County
Trinity County
Tulare County
Tuolumne County
Ventura County
Yolo County
Yuba County
Adams County
Alamosa County
Arapahoe County
Archuleta County
Baca County
Bent County
Boulder County
Broomfield County
Chaffee County
Cheyenne County
Clear Creek County
Conejos County
Costilla County
Crowley County
Custer County
Delta County
Denver County
Dolores County
Douglas County
Eagle County
Elbert County
El Paso County
Fremont County
Garfield County
Gilpin County
Grand County
Gunnison County
Hinsdale County
Huerfano County
Kiowa County
Kit Carson County
La Plata County
Larimer County
Las Animas County
Mesa County
Mineral County
Moffat County
Montezuma County
Montrose County
Otero County
Ouray County
Park County
Pitkin County
Prowers County
Pueblo County
Rio Blanco County
Rio Grande County
Routt County
Saguache County
San Juan County
San Miguel County
Sedgwick County
Summit County
Teller County
Weld County
Fairfield County
Hartford County
Litchfield County
Middlesex County
New Haven County
New London County
Tolland County
Windham County
Kent County
New Castle County
Sussex County
District of Columbia
Alachua County
Baker County
Bay County
Bradford County
Brevard County
Broward County
Charlotte County
Citrus County
Collier County
DeSoto County
Dixie County
Duval County
Flagler County
Gadsden County
Gilchrist County
Glades County
Gulf County
Hamilton County
Hardee County
Hendry County
Hernando County
Highlands County
Hillsborough County
Holmes County
Indian River County
Leon County
Levy County
Liberty County
Manatee County
Martin County
Miami-Dade County
Nassau County
Okaloosa County
Okeechobee County
Osceola County
Palm Beach County
Pasco County
Pinellas County
Putnam County
St. Johns County
St. Lucie County
Santa Rosa County
Sarasota County
Seminole County
Suwannee County
Taylor County
Volusia County
Wakulla County
Walton County
Appling County
Atkinson County
Bacon County
Banks County
Barrow County
Bartow County
Ben Hill County
Berrien County
Bleckley County
Brantley County
Brooks County
Bryan County
Bulloch County
Burke County
Butts County
Camden County
Candler County
Catoosa County
Charlton County
Chatham County
Chattahoochee County
Chattooga County
Clayton County
Clinch County
Cobb County
Colquitt County
Cook County
Coweta County
Crisp County
Dade County
Dawson County
Decatur County
Dodge County
Dooly County
Dougherty County
Early County
Echols County
Effingham County
Emanuel County
Evans County
Fannin County
Floyd County
Forsyth County
Gilmer County
Glascock County
Glynn County
Gordon County
Grady County
Gwinnett County
Habersham County
Hall County
Hancock County
Haralson County
Harris County
Hart County
Heard County
Irwin County
Jasper County
Jeff Davis County
Jenkins County
Jones County
Lanier County
Laurens County
Long County
Lumpkin County
McDuffie County
McIntosh County
Meriwether County
Mitchell County
Murray County
Muscogee County
Oconee County
Oglethorpe County
Paulding County
Peach County
Pierce County
Quitman County
Rabun County
Richmond County
Rockdale County
Schley County
Screven County
Spalding County
Stephens County
Stewart County
Talbot County
Taliaferro County
Tattnall County
Telfair County
Terrell County
Thomas County
Tift County
Toombs County
Towns County
Treutlen County
Troup County
Turner County
Twiggs County
Upson County
Ware County
Warren County
Wayne County
Webster County
Wheeler County
Whitfield County
Wilkes County
Wilkinson County
Worth County
Hawaii County
Honolulu County
Kalawao County
Kauai County
Maui County
Ada County
Bannock County
Bear Lake County
Benewah County
Bingham County
Blaine County
Boise County
Bonner County
Bonneville County
Boundary County
Camas County
Canyon County
Caribou County
Cassia County
Clearwater County
Gem County
Gooding County
Idaho County
Jerome County
Kootenai County
Latah County
Lemhi County
Lewis County
Minidoka County
Nez Perce County
Oneida County
Owyhee County
Payette County
Power County
Shoshone County
Teton County
Twin Falls County
Valley County
Alexander County
Bond County
Brown County
Bureau County
Cass County
Champaign County
Christian County
Clinton County
Coles County
Cumberland County
De Witt County
DuPage County
Edgar County
Edwards County
Ford County
Gallatin County
Grundy County
Hardin County
Henderson County
Iroquois County
Jersey County
Jo Daviess County
Kane County
Kankakee County
Kendall County
Knox County
LaSalle County
Livingston County
McDonough County
McHenry County
McLean County
Macoupin County
Mason County
Massac County
Menard County
Mercer County
Moultrie County
Ogle County
Peoria County
Piatt County
Richland County
Rock Island County
Sangamon County
Schuyler County
Stark County
Stephenson County
Tazewell County
Vermilion County
Wabash County
Whiteside County
Will County
Williamson County
Winnebago County
Woodford County
Allen County
Bartholomew County
Blackford County
Daviess County
Dearborn County
Delaware County
Dubois County
Elkhart County
Fountain County
Gibson County
Harrison County
Hendricks County
Huntington County
Jay County
Jennings County
Kosciusko County
LaGrange County
LaPorte County
Miami County
Noble County
Ohio County
Owen County
Parke County
Porter County
Posey County
Ripley County
Rush County
St. Joseph County
Spencer County
Starke County
Steuben County
Sullivan County
Switzerland County
Tippecanoe County
Tipton County
Vanderburgh County
Vermillion County
Vigo County
Warrick County
Wells County
Whitley County
Adair County
Allamakee County
Appanoose County
Audubon County
Black Hawk County
Bremer County
Buchanan County
Buena Vista County
Cedar County
Cerro Gordo County
Chickasaw County
Davis County
Des Moines County
Dickinson County
Dubuque County
Emmet County
Guthrie County
Ida County
Iowa County
Keokuk County
Kossuth County
Linn County
Louisa County
Lucas County
Lyon County
Mahaska County
Mills County
Monona County
Muscatine County
O'Brien County
Page County
Palo Alto County
Plymouth County
Pocahontas County
Pottawattamie County
Poweshiek County
Ringgold County
Sac County
Sioux County
Story County
Tama County
Wapello County
Winneshiek County
Woodbury County
Wright County
Anderson County
Atchison County
Barber County
Barton County
Bourbon County
Chase County
Chautauqua County
Cloud County
Coffey County
Comanche County
Cowley County
Doniphan County
Elk County
Ellis County
Ellsworth County
Finney County
Geary County
Gove County
Gray County
Greeley County
Greenwood County
Harper County
Harvey County
Haskell County
Hodgeman County
Jewell County
Kearny County
Kingman County
Labette County
Lane County
Leavenworth County
McPherson County
Meade County
Morris County
Morton County
Nemaha County
Neosho County
Ness County
Norton County
Osage County
Osborne County
Ottawa County
Pawnee County
Pottawatomie County
Pratt County
Rawlins County
Reno County
Republic County
Rice County
Riley County
Rooks County
Seward County
Shawnee County
Sheridan County
Sherman County
Smith County
Stafford County
Stanton County
Stevens County
Sumner County
Trego County
Wabaunsee County
Wallace County
Wichita County
Wilson County
Woodson County
Wyandotte County
Ballard County
Barren County
Bath County
Bell County
Boyd County
Boyle County
Bracken County
Breathitt County
Breckinridge County
Bullitt County
Caldwell County
Calloway County
Campbell County
Carlisle County
Carter County
Casey County
Edmonson County
Elliott County
Estill County
Fleming County
Garrard County
Graves County
Grayson County
Green County
Greenup County
Harlan County
Hickman County
Hopkins County
Jessamine County
Kenton County
Knott County
Larue County
Laurel County
Leslie County
Letcher County
McCracken County
McCreary County
Magoffin County
Menifee County
Metcalfe County
Muhlenberg County
Nelson County
Nicholas County
Oldham County
Owsley County
Pendleton County
Powell County
Robertson County
Rockcastle County
Rowan County
Simpson County
Todd County
Trigg County
Trimble County
Wolfe County
Acadia Parish
Allen Parish
Ascension Parish
Assumption Parish
Avoyelles Parish
Beauregard Parish
Bienville Parish
Bossier Parish
Caddo Parish
Calcasieu Parish
Caldwell Parish
Cameron Parish
Catahoula Parish
Claiborne Parish
Concordia Parish
De Soto Parish
East Baton Rouge Parish
East Carroll Parish
East Feliciana Parish
Evangeline Parish
Franklin Parish
Grant Parish
Iberia Parish
Iberville Parish
Jackson Parish
Jefferson Parish
Jefferson Davis Parish
Lafayette Parish
Lafourche Parish
LaSalle Parish
Lincoln Parish
Livingston Parish
Madison Parish
Morehouse Parish
Natchitoches Parish
Orleans Parish
Ouachita Parish
Plaquemines Parish
Pointe Coupee Parish
Rapides Parish
Red River Parish
Richland Parish
Sabine Parish
St. Bernard Parish
St. Charles Parish
St. Helena Parish
St. James Parish
St. John the Baptist Parish
St. Landry Parish
St. Martin Parish
St. Mary Parish
St. Tammany Parish
Tangipahoa Parish
Tensas Parish
Terrebonne Parish
Union Parish
Vermilion Parish
Vernon Parish
Washington Parish
Webster Parish
West Baton Rouge Parish
West Carroll Parish
West Feliciana Parish
Winn Parish
Androscoggin County
Aroostook County
Kennebec County
Oxford County
Penobscot County
Piscataquis County
Sagadahoc County
Somerset County
Waldo County
York County
Allegany County
Anne Arundel County
Baltimore County
Calvert County
Caroline County
Cecil County
Charles County
Dorchester County
Frederick County
Garrett County
Harford County
Prince George's County
Queen Anne's County
St. Mary's County
Wicomico County
Worcester County
Baltimore city
Barnstable County
Berkshire County
Bristol County
Dukes County
Essex County
Hampden County
Hampshire County
Nantucket County
Norfolk County
Suffolk County
Alcona County
Alger County
Allegan County
Alpena County
Antrim County
Arenac County
Baraga County
Barry County
Benzie County
Branch County
Charlevoix County
Cheboygan County
Chippewa County
Clare County
Eaton County
Genesee County
Gladwin County
Gogebic County
Grand Traverse County
Gratiot County
Hillsdale County
Houghton County
Huron County
Ingham County
Ionia County
Iosco County
Iron County
Isabella County
Kalamazoo County
Kalkaska County
Keweenaw County
Lapeer County
Leelanau County
Lenawee County
Luce County
Mackinac County
Macomb County
Manistee County
Marquette County
Mecosta County
Menominee County
Midland County
Missaukee County
Montcalm County
Montmorency County
Muskegon County
Newaygo County
Oakland County
Oceana County
Ogemaw County
Ontonagon County
Oscoda County
Otsego County
Presque Isle County
Roscommon County
Saginaw County
Sanilac County
Schoolcraft County
Shiawassee County
Tuscola County
Washtenaw County
Wexford County
Aitkin County
Anoka County
Becker County
Beltrami County
Big Stone County
Blue Earth County
Carlton County
Carver County
Chisago County
Cottonwood County
Crow Wing County
Dakota County
Faribault County
Fillmore County
Freeborn County
Goodhue County
Hennepin County
Hubbard County
Isanti County
Itasca County
Kanabec County
Kandiyohi County
Kittson County
Koochiching County
Lac qui Parle County
Lake of the Woods County
Le Sueur County
McLeod County
Mahnomen County
Meeker County
Mille Lacs County
Morrison County
Mower County
Nicollet County
Nobles County
Norman County
Olmsted County
Otter Tail County
Pennington County
Pine County
Pipestone County
Ramsey County
Red Lake County
Redwood County
Renville County
Rock County
Roseau County
St. Louis County
Sherburne County
Sibley County
Stearns County
Steele County
Swift County
Traverse County
Wabasha County
Wadena County
Waseca County
Watonwan County
Wilkin County
Winona County
Yellow Medicine County
Alcorn County
Amite County
Attala County
Bolivar County
Claiborne County
Coahoma County
Copiah County
Forrest County
George County
Grenada County
Hinds County
Humphreys County
Issaquena County
Itawamba County
Jefferson Davis County
Kemper County
Leake County
Leflore County
Neshoba County
Noxubee County
Oktibbeha County
Panola County
Pearl River County
Pontotoc County
Prentiss County
Rankin County
Sharkey County
Sunflower County
Tallahatchie County
Tate County
Tippah County
Tishomingo County
Tunica County
Walthall County
Yalobusha County
Yazoo County
Andrew County
Audrain County
Bates County
Bollinger County
Callaway County
Cape Girardeau County
Chariton County
Cole County
Cooper County
Dent County
Dunklin County
Gasconade County
Gentry County
Hickory County
Holt County
Howell County
Laclede County
McDonald County
Maries County
Moniteau County
New Madrid County
Nodaway County
Oregon County
Ozark County
Pemiscot County
Pettis County
Phelps County
Platte County
Ralls County
Ray County
Reynolds County
St. Charles County
Ste. Genevieve County
St. Francois County
Scotland County
Shannon County
Stoddard County
Taney County
Texas County
Vernon County
St. Louis city
Beaverhead County
Big Horn County
Broadwater County
Carbon County
Cascade County
Chouteau County
Daniels County
Deer Lodge County
Fallon County
Fergus County
Flathead County
Glacier County
Golden Valley County
Granite County
Hill County
Judith Basin County
Lewis and Clark County
McCone County
Meagher County
Missoula County
Musselshell County
Petroleum County
Pondera County
Powder River County
Ravalli County
Roosevelt County
Rosebud County
Sanders County
Silver Bow County
Stillwater County
Sweet Grass County
Toole County
Treasure County
Wheatland County
Wibaux County
Yellowstone County
Antelope County
Arthur County
Banner County
Box Butte County
Buffalo County
Burt County
Cherry County
Colfax County
Cuming County
Dawes County
Deuel County
Dixon County
Dundy County
Frontier County
Furnas County
Gage County
Garden County
Gosper County
Hayes County
Hitchcock County
Hooker County
Kearney County
Keith County
Keya Paha County
Kimball County
Lancaster County
Loup County
Merrick County
Morrill County
Nance County
Nuckolls County
Otoe County
Perkins County
Red Willow County
Richardson County
Sarpy County
Saunders County
Scotts Bluff County
Thayer County
Thurston County
Churchill County
Elko County
Esmeralda County
Eureka County
Lander County
Nye County
Pershing County
Storey County
Washoe County
White Pine County
Carson City
Belknap County
Cheshire County
Coos County
Grafton County
Merrimack County
Rockingham County
Strafford County
Atlantic County
Bergen County
Burlington County
Cape May County
Gloucester County
Hudson County
Hunterdon County
Monmouth County
Ocean County
Passaic County
Salem County
Bernalillo County
Catron County
Chaves County
Cibola County
Curry County
De Baca County
Doña Ana County
Eddy County
Guadalupe County
Harding County
Hidalgo County
Lea County
Los Alamos County
Luna County
McKinley County
Mora County
Quay County
Rio Arriba County
Sandoval County
Santa Fe County
Socorro County
Taos County
Torrance County
Valencia County
Albany County
Bronx County
Broome County
Cattaraugus County
Cayuga County
Chemung County
Chenango County
Cortland County
Dutchess County
Erie County
Herkimer County
New York County
Niagara County
Onondaga County
Ontario County
Orleans County
Oswego County
Queens County
Rensselaer County
Rockland County
St. Lawrence County
Saratoga County
Schenectady County
Schoharie County
Seneca County
Tioga County
Tompkins County
Ulster County
Westchester County
Wyoming County
Yates County
Alamance County
Alleghany County
Anson County
Ashe County
Avery County
Beaufort County
Bertie County
Bladen County
Brunswick County
Buncombe County
Cabarrus County
Carteret County
Caswell County
Catawba County
Chowan County
Columbus County
Craven County
Currituck County
Dare County
Davidson County
Davie County
Duplin County
Durham County
Edgecombe County
Gaston County
Gates County
Granville County
Guilford County
Halifax County
Harnett County
Haywood County
Hertford County
Hoke County
Hyde County
Iredell County
Johnston County
Lenoir County
McDowell County
Mecklenburg County
Moore County
Nash County
New Hanover County
Northampton County
Onslow County
Pamlico County
Pasquotank County
Pender County
Perquimans County
Person County
Pitt County
Robeson County
Rutherford County
Sampson County
Stanly County
Stokes County
Surry County
Swain County
Transylvania County
Tyrrell County
Vance County
Wake County
Watauga County
Yadkin County
Yancey County
Barnes County
Benson County
Billings County
Bottineau County
Bowman County
Burleigh County
Cavalier County
Dickey County
Divide County
Dunn County
Emmons County
Foster County
Grand Forks County
Griggs County
Hettinger County
Kidder County
LaMoure County
McKenzie County
Mountrail County
Oliver County
Pembina County
Ransom County
Rolette County
Sargent County
Slope County
Stutsman County
Towner County
Traill County
Walsh County
Ward County
Williams County
Ashland County
Ashtabula County
Athens County
Auglaize County
Belmont County
Clermont County
Columbiana County
Coshocton County
Cuyahoga County
Darke County
Defiance County
Gallia County
Geauga County
Guernsey County
Highland County
Hocking County
Licking County
Lorain County
Mahoning County
Medina County
Meigs County
Morrow County
Muskingum County
Pickaway County
Portage County
Preble County
Ross County
Sandusky County
Scioto County
Trumbull County
Tuscarawas County
Van Wert County
Vinton County
Wood County
Wyandot County
Alfalfa County
Atoka County
Beaver County
Beckham County
Caddo County
Canadian County
Cimarron County
Coal County
Cotton County
Craig County
Creek County
Dewey County
Garvin County
Greer County
Harmon County
Hughes County
Kay County
Kingfisher County
Latimer County
Le Flore County
Love County
McClain County
McCurtain County
Major County
Mayes County
Muskogee County
Nowata County
Okfuskee County
Oklahoma County
Okmulgee County
Payne County
Pittsburg County
Pushmataha County
Roger Mills County
Rogers County
Sequoyah County
Tillman County
Tulsa County
Wagoner County
Washita County
Woods County
Woodward County
Clackamas County
Clatsop County
Crook County
Deschutes County
Gilliam County
Harney County
Hood River County
Josephine County
Klamath County
Malheur County
Multnomah County
Tillamook County
Umatilla County
Wallowa County
Wasco County
Yamhill County
Allegheny County
Armstrong County
Bedford County
Berks County
Blair County
Bucks County
Cambria County
Cameron County
Centre County
Chester County
Clarion County
Clearfield County
Dauphin County
Forest County
Huntingdon County
Indiana County
Juniata County
Lackawanna County
Lebanon County
Lehigh County
Luzerne County
Lycoming County
McKean County
Mifflin County
Montour County
Northumberland County
Philadelphia County
Potter County
Schuylkill County
Snyder County
Susquehanna County
Venango County
Westmoreland County
Newport County
Providence County
Abbeville County
Aiken County
Allendale County
Bamberg County
Barnwell County
Berkeley County
Charleston County
Chesterfield County
Clarendon County
Colleton County
Darlington County
Dillon County
Edgefield County
Florence County
Georgetown County
Greenville County
Hampton County
Horry County
Kershaw County
Lexington County
McCormick County
Marlboro County
Newberry County
Orangeburg County
Saluda County
Spartanburg County
Williamsburg County
Aurora County
Beadle County
Bennett County
Bon Homme County
Brookings County
Brule County
Charles Mix County
Codington County
Corson County
Davison County
Day County
Edmunds County
Fall River County
Faulk County
Gregory County
Haakon County
Hamlin County
Hand County
Hanson County
Hutchinson County
Jerauld County
Kingsbury County
Lyman County
McCook County
Mellette County
Miner County
Minnehaha County
Moody County
Oglala Lakota County
Roberts County
Sanborn County
Spink County
Stanley County
Sully County
Tripp County
Walworth County
Yankton County
Ziebach County
Bledsoe County
Cannon County
Cheatham County
Cocke County
Crockett County
Dickson County
Dyer County
Fentress County
Giles County
Grainger County
Hamblen County
Hardeman County
Hawkins County
Loudon County
McMinn County
McNairy County
Maury County
Obion County
Overton County
Pickett County
Rhea County
Roane County
Sequatchie County
Trousdale County
Unicoi County
Weakley County
Andrews County
Angelina County
Aransas County
Archer County
Atascosa County
Austin County
Bailey County
Bandera County
Bastrop County
Baylor County
Bee County
Bexar County
Blanco County
Borden County
Bosque County
Bowie County
Brazoria County
Brazos County
Brewster County
Briscoe County
Burleson County
Burnet County
Callahan County
Camp County
Carson County
Castro County
Childress County
Cochran County
Coke County
Coleman County
Collin County
Collingsworth County
Colorado County
Comal County
Concho County
Cooke County
Coryell County
Cottle County
Crane County
Crosby County
Culberson County
Dallam County
Deaf Smith County
Denton County
DeWitt County
Dickens County
Dimmit County
Donley County
Eastland County
Ector County
Erath County
Falls County
Fisher County
Foard County
Fort Bend County
Freestone County
Frio County
Gaines County
Galveston County
Garza County
Gillespie County
Glasscock County
Goliad County
Gonzales County
Gregg County
Grimes County
Hansford County
Hartley County
Hays County
Hemphill County
Hockley County
Hood County
Hudspeth County
Hunt County
Irion County
Jack County
Jim Hogg County
Jim Wells County
Karnes County
Kaufman County
Kenedy County
Kerr County
Kimble County
King County
Kinney County
Kleberg County
Lamb County
Lampasas County
La Salle County
Lavaca County
Lipscomb County
Live Oak County
Llano County
Loving County
Lubbock County
Lynn County
McCulloch County
McLennan County
McMullen County
Matagorda County
Maverick County
Milam County
Montague County
Motley County
Nacogdoches County
Navarro County
Nolan County
Nueces County
Ochiltree County
Palo Pinto County
Parker County
Parmer County
Pecos County
Presidio County
Rains County
Randall County
Reagan County
Real County
Red River County
Reeves County
Refugio County
Rockwall County
Runnels County
Rusk County
Sabine County
San Augustine County
San Jacinto County
San Patricio County
San Saba County
Schleicher County
Scurry County
Shackelford County
Somervell County
Starr County
Sterling County
Stonewall County
Sutton County
Swisher County
Tarrant County
Terry County
Throckmorton County
Titus County
Tom Green County
Travis County
Tyler County
Upshur County
Upton County
Uvalde County
Val Verde County
Van Zandt County
Victoria County
Waller County
Webb County
Wharton County
Wilbarger County
Willacy County
Winkler County
Wise County
Yoakum County
Young County
Zapata County
Zavala County
Box Elder County
Cache County
Daggett County
Duchesne County
Emery County
Juab County
Millard County
Piute County
Rich County
Salt Lake County
Sanpete County
Tooele County
Uintah County
Utah County
Wasatch County
Weber County
Addison County
Bennington County
Caledonia County
Chittenden County
Grand Isle County
Lamoille County
Rutland County
Windsor County
Accomack County
Albemarle County
Amelia County
Amherst County
Appomattox County
Arlington County
Augusta County
Bland County
Botetourt County
Buckingham County
Charles City County
Culpeper County
Dickenson County
Dinwiddie County
Fairfax County
Fauquier County
Fluvanna County
Goochland County
Greensville County
Hanover County
Henrico County
Isle of Wight County
James City County
King and Queen County
King George County
King William County
Loudoun County
Lunenburg County
Mathews County
New Kent County
Nottoway County
Patrick County
Pittsylvania County
Powhatan County
Prince Edward County
Prince George County
Prince William County
Rappahannock County
Roanoke County
Rockbridge County
Shenandoah County
Smyth County
Southampton County
Spotsylvania County
Wythe County
Alexandria city
Bedford city
Bristol city
Buena Vista city
Charlottesville city
Chesapeake city
Colonial Heights city
Covington city
Danville city
Emporia city
Fairfax city
Falls Church city
Franklin city
Fredericksburg city
Galax city
Hampton city
Harrisonburg city
Hopewell city
Lexington city
Lynchburg city
Manassas city
Manassas Park city
Martinsville city
Newport News city
Norfolk city
Norton city
Petersburg city
Poquoson city
Portsmouth city
Radford city
Richmond city
Roanoke city
Salem city
Staunton city
Suffolk city
Virginia Beach city
Waynesboro city
Williamsburg city
Winchester city
Asotin County
Chelan County
Clallam County
Cowlitz County
Ferry County
Grays Harbor County
Island County
Kitsap County
Kittitas County
Klickitat County
Okanogan County
Pacific County
Pend Oreille County
Skagit County
Skamania County
Snohomish County
Spokane County
Wahkiakum County
Walla Walla County
Whatcom County
Whitman County
Yakima County
Braxton County
Brooke County
Cabell County
Doddridge County
Greenbrier County
Hardy County
Kanawha County
Mingo County
Monongalia County
Pleasants County
Preston County
Raleigh County
Ritchie County
Summers County
Tucker County
Wetzel County
Wirt County
Barron County
Bayfield County
Burnett County
Calumet County
Dane County
Door County
Eau Claire County
Fond du Lac County
Green Lake County
Juneau County
Kenosha County
Kewaunee County
La Crosse County
Langlade County
Manitowoc County
Marathon County
Marinette County
Milwaukee County
Oconto County
Outagamie County
Ozaukee County
Pepin County
Price County
Racine County
St. Croix County
Sauk County
Sawyer County
Shawano County
Sheboygan County
Trempealeau County
Vilas County
Washburn County
Waukesha County
Waupaca County
Waushara County
Converse County
Goshen County
Hot Springs County
Laramie County
Natrona County
Niobrara County
Sublette County
Sweetwater County
Uinta County
Washakie County
Weston County

What if a county in counties doesn’t have a match in ca_tax_rev?

ca_tax_rev |> 
  distinct(entity_name)
entity_name
Alameda County
Alpine County
Amador County
Butte County
Calaveras County
Colusa County
Contra Costa County
Del Norte County
El Dorado County
Fresno County
Glenn County
Humboldt County
Imperial County
Inyo County
Kern County
Kings County
Lake County
Lassen County
Los Angeles County
Madera County
Marin County
Mariposa County
Mendocino County
Merced County
Modoc County
Mono County
Monterey County
Napa County
Nevada County
Orange County
Placer County
Plumas County
Riverside County
Sacramento County
San Benito County
San Bernardino County
San Diego County
San Joaquin County
San Luis Obispo County
San Mateo County
Santa Barbara County
Santa Clara County
Santa Cruz County
Shasta County
Sierra County
Siskiyou County
Solano County
Sonoma County
Stanislaus County
Sutter County
Tehama County
Trinity County
Tulare County
Tuolumne County
Ventura County
Yolo County
Yuba County

What if a county in ca_tax_rev doesn’t have a match in counties?

Every county!

What if a there are counties that don’t have matches?

Piping Joins

Remember: the dataset you pipe in becomes the first argument of the function you are piping into!

  • So if you are using a pipe, you will only be specifying the right (x) dataset inside the join_XXX() function.
left_join(x = counties, 
          y = ca_tax_rev, 
          by = join_by(county_name == entity_name)
          )

…is equivalent to…

counties |> 
  left_join(y = ca_tax_rev, 
            by = join_by(county_name == entity_name)
            )

Lab 4 Preview: Joining Multiple Data Sets

Suppose we wanted to compare the taxes and costs of childcare for counties in California. To do this, we would need to join all three datasets together!

A figure showing the relations between three different datasets: childcare_costs, counties, and ca_tax_revenue. The childcare_costs dataset has an arrow connecting the variable 'county_fips_code' to the 'county_fips' in the counties dataset. The counties dataset has an arrow connecting the 'county name' variable to the 'entity name' variable in the ca_tax_revenue dataset. Each of the arrows represents the keys (variables) that link each dataset.

Practice Activity 4

An image of two datasets, one named military_expenditures and one named region_totals. The military_expenditures datast has five (visible) columns titled: Country, Year, Expenditures, Notes, Reporting year. The region_totals dataset has 13 (visible) columns: Region, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 9157, 1958, 1959, 1960, and 1961. The Country column of military_expenditures is highlighted in red and the Region column of the region_totals column is also highlighted in red. The image is highlighting these columns as they are 'keys' linking the two datasets with one another.

Filtering Joins

Filter observations based on values in new dataframe.

Filtering Joins: anti_join()

Removes observations when their keys are present in both datasets, and only keeps variables from the first dataset.

A looping animation shows two tables being compared under an ‘anti join’ operation. The left table has keys 1 (red), 2 (blue), 3 (green) paired with values x1, x2, x3. The right table has keys 1 (red), 2 (blue), and 4 (purple) paired with values y1, y2, y4. Lines indicate matching keys (1 and 2). The resulting table on the right contains only the rows from the left table that do not have a match in the right: key 3 with x3 (green). Keys 1 and 2 are excluded because they have matches in the right table.

© Garrick Aden-Buie

Filtering Joins: anti_join()

regions <- cont_region |> 
  pull(Region)
  
military |> 
  filter(! Country %in% regions)
anti_join(military, 
          cont_region, 
          by = join_by(Country == Region))
Country Notes Reporting year 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
Algeria 1 NA NA NA 0.0568262 0.0435630 0.0745002 0.0763412 0.1013217 0.0998956 0.1097406 0.1196480 0.1281752 0.1175623 0.1201709 0.1222571 0.1079421 0.1009629 0.1067414 0.1045512 0.0916289 0.0879553 0.0797041 0.0903417 0.0944418 0.1078105 0.1024519 0.1338797 0.1366434 0.1368705 0.1532440 0.1535568 0.1447392 0.1553483
Libya ‡ ¶ 2 NA NA NA NA NA NA NA NA NA NA 0.1168726 0.1421352 0.1152520 0.1026777 0.0629681 0.0524013 0.0483592 0.0489997 0.0502390 0.0358778 0.0280920 0.0309184 NA NA NA 0.0819762 0.0867235 0.1081692 NA NA NA NA NA
Morocco 3 NA NA NA 0.1450021 0.1580370 0.1511296 0.1581092 0.1629826 0.1600396 0.1761395 0.1778012 0.1703428 0.1454047 0.0897852 0.1452659 0.1249913 0.1339743 0.1226655 0.1051286 0.1106090 0.1065254 0.1041112 0.1081203 0.1091353 0.0975643 0.0983285 0.1155622 0.1118756 0.1052065 0.1054605 0.1059254 0.1047862 0.1030490
Tunisia NA NA NA NA NA 0.0632685 0.0632905 0.0619165 0.0640179 0.0625820 0.0667414 0.0670901 0.0661690 0.0617887 0.0613768 0.0604532 0.0589839 0.0602641 0.0590531 0.0600652 0.0603392 0.0515455 0.0519746 0.0502902 0.0515089 0.0532949 0.0507900 0.0506320 0.0640141 0.0778210 0.0817632 0.0707334 0.0689165 0.0788713
Sub-Saharan NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Angola 4 NA NA NA NA NA NA NA NA NA 0.0603292 0.1387546 0.0623387 0.2737552 0.1288332 0.1078863 0.0919173 0.1093456 0.1164700 0.1391894 0.1229089 0.0816726 0.0678449 0.1046416 0.1060449 0.0870454 0.0869862 0.1202507 0.1288774 0.1147985 0.1239996 0.1053525 0.0950392 0.0887121
Benin NA NA NA 0.1046518 0.0923934 NA NA NA NA NA NA NA NA 0.0451694 0.0263947 0.0231735 0.0407498 0.0472912 0.0506117 0.0481642 0.0511866 NA 0.0456348 NA NA NA 0.0493158 0.0461420 0.0492757 0.0439874 0.0436613 0.0517636 0.0382293 0.0285960
Botswana NA April-March 0.1002485 0.0958924 0.1027208 0.1042048 0.0998411 0.1020170 0.1031924 0.0913827 0.0779530 0.0808018 0.0863154 0.0758781 0.0816921 0.0898636 0.0900430 0.0915458 0.0847811 0.0822652 0.0807114 0.0757866 0.0645590 0.0598189 0.0616589 0.0642521 0.0611376 0.0616763 0.0614716 0.0714148 0.0996490 0.0927106 0.0845517 0.0858634
Burkina Faso NA 0.1388681 0.1883483 0.1715413 0.1403639 0.1384291 0.0941533 0.0796159 0.0708714 0.0646393 0.0699255 0.0634202 0.0575814 0.0624420 0.0587756 0.0605109 0.0609743 0.0595841 0.0594498 0.0507504 0.0619887 0.0668571 0.0628634 0.0565589 0.0563175 0.0518807 0.0489335 0.0607970 0.0614370 0.0538717 0.0519531 0.0794946 0.0901480
Burundi NA NA NA 0.1728188 0.1637926 0.1185305 0.1382760 0.2010519 0.1636200 0.2060141 0.2911908 0.2833899 0.2475613 0.1972922 0.2390262 0.2260865 0.1517343 0.1201666 0.1338528 0.0962808 0.0876318 0.0661009 NA NA NA 0.0673123 0.0713968 0.0666852 0.0810186 0.0999647 0.0857998 0.0843062 0.0777622
Cameroon § NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0800897 0.0777887 0.0850039 0.0898649 0.0877483 0.0920522 0.0983515 0.0922271 0.0789088 0.0839264 0.0848379 0.0636479 0.0685245 0.0606543 0.0552894 0.0547564 0.0567976 0.0592013 0.0599363 0.0601975
Cape Verde NA NA NA NA NA NA NA NA 0.0158766 0.0244515 0.0179162 0.0193457 0.0233453 0.0208191 0.0273834 0.0242666 0.0182693 0.0223408 0.0194574 0.0193606 0.0169370 0.0177847 0.0198763 0.0146890 0.0126421 0.0157205 0.0160227 0.0156694 0.0177393 0.0177751 0.0206414 0.0168143 0.0174671 0.0143083
Central African Rep. ‡ 5 NA NA NA NA 0.0679529 0.0703357 0.0717624 0.0560625 0.0563913 0.1031086 NA NA NA NA NA 0.0653386 0.1029339 0.0883141 0.0674518 NA 0.0846088 0.0967063 0.1091900 0.1396319 0.1446822 0.1174574 0.2115005 0.1126569 0.1128143 0.1216001 0.0968587 0.0823569 0.0804756
Chad NA NA NA NA NA NA NA NA NA 0.0767471 0.0877557 0.0610439 0.0619643 0.0721553 0.0748031 0.0870748 0.0852658 0.0683712 0.0792807 0.0722812 0.2150181 0.2629371 0.3131258 0.3295819 0.2367092 0.2239824 NA 0.2452233 0.1276971 0.1100759 0.2113650 0.1476643 0.1720097 0.1397526
Congo, Republic of § NA NA NA NA NA 0.1168660 0.1109759 NA NA NA NA NA NA NA 0.0616342 0.0660758 0.0900418 0.1000518 0.0686164 0.0589304 0.0670461 0.0740830 NA 0.0722949 NA NA 0.0482283 0.0811402 NA 0.1184026 0.1194529 0.1111707 0.1134089
Congo, Dem. Rep. 6 NA NA NA NA NA NA NA NA NA 0.1605735 0.1266974 0.0347121 0.1216457 0.0887129 NA NA 0.0958688 0.1793905 0.1582334 0.1566874 0.1259632 0.0692766 0.0526269 0.0534979 0.0660805 0.0825988 0.0898995 0.0513921 0.0751894 0.0736443 0.0741709 0.0558946 0.0644622
Côte d’Ivoire 7 NA NA NA NA NA NA NA NA NA NA 0.0380433 NA NA NA NA NA 0.0794292 0.0811412 0.0778179 0.0751365 0.0775368 0.0755134 0.0870146 0.0779169 0.0763090 0.0681868 0.0627481 0.0701859 0.0753771 0.0712717 0.0534586 0.0593170 0.0519392
Djibouti NA NA NA NA 0.1622224 0.1767062 0.1436193 0.1343930 0.1438094 0.1568639 0.1493627 0.1504591 0.1539759 0.1499102 0.1436219 0.1532120 0.1697274 0.1833074 0.1495281 0.1718367 0.1922027 0.1090962 0.0910797 NA NA NA NA NA NA NA NA NA NA NA
Equatorial Guinea NA NA NA NA NA NA NA NA 0.0038961 0.0144565 NA NA NA NA NA NA NA NA NA NA NA 0.0762776 0.0745153 0.0621106 NA NA NA NA 0.0242477 0.0250520 0.0445563 0.0562511 0.0590119 NA
Eritrea 8 NA NA NA NA NA NA 0.4100380 0.3261710 0.3109362 0.3829509 0.2548011 0.4772492 0.4188477 0.4403411 0.3206128 0.3304648 0.3113802 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Ethiopia 9 July-June 0.2601165 0.2822313 0.3077163 0.2258404 0.1701784 0.1569745 0.1145475 0.0900800 0.0787914 0.1509833 0.2880473 0.3616539 0.2953038 0.1923352 0.1484202 0.1207913 0.1327337 0.1206455 0.1027121 0.0907966 0.0794309 0.0692353 0.0613303 0.0598366 0.0521593 0.0454170 0.0439500 0.0407149 0.0381604 0.0365197 0.0397322 0.0389459
Gabon 10 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0833464 0.0644539 0.0693238 0.0785105 0.0772810 0.0601263 0.0606875 NA NA NA 0.0810552 0.0672668 0.0676340 0.0462601 0.0481918 0.0532516 0.0662561 0.1000005 0.0906958 0.0954327
Gambia ‡ 11 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0345248 0.0252957 0.0296443 0.0254806 0.0162238 0.0224356 0.0188525 0.0317429 0.0951299 0.0340876 NA NA 0.0412998 0.0426905 0.0625565 0.0515302 NA NA 0.0324941 0.0347251
Ghana 12 NA 0.0230150 0.0226148 0.0264882 0.0331087 0.0256352 0.0233333 0.0221761 0.0241078 0.0214923 0.0223376 0.0262994 0.0278275 0.0344006 0.0178950 0.0227838 0.0233671 0.0188439 0.0188835 0.0170445 0.0205891 0.0166337 0.0192634 0.0142197 0.0222866 0.0269926 0.0185626 0.0231320 0.0210978 0.0146507 0.0177850 0.0155957 0.0154001
Guinea 13 NA NA NA NA 0.1050059 0.0878312 0.0724618 0.0771710 NA NA 0.0669070 0.0849646 0.0990163 0.0899216 0.1536141 0.1674514 0.1196876 0.1241676 NA NA NA NA NA NA NA 0.1140962 0.1260595 0.1110223 0.1160151 0.1166324 0.1017483 0.1041626 0.0776593
Guinea-Bissau 14 NA NA NA NA NA NA NA 0.0108260 0.0196511 0.0229406 0.0204432 0.0562829 NA 0.1038344 0.0786319 0.0974511 0.0797718 NA 0.0939466 NA NA NA 0.0752289 0.0983299 0.0875695 0.1798783 0.1576263 0.0824864 0.0687806 0.0616382 0.0722637 NA NA
Kenya NA NA 0.1001394 0.0897913 0.0886244 0.0762388 0.0588552 0.0533089 0.0497526 0.0540987 0.0621314 0.0575525 0.0543301 0.0579087 0.0627378 0.0682192 0.0685557 0.0693808 0.0713102 0.0703348 0.0680924 0.0700565 0.0707901 0.0674954 0.0642294 0.0653917 0.0689272 0.0615017 0.0490934 0.0484682 0.0487789 0.0493297 0.0497214 0.0459566
Lesotho NA April-March 0.0894432 0.1133843 0.1091187 0.0933333 0.0782843 0.0701066 0.0698630 0.0791587 0.0697225 0.0620601 0.0564336 0.0710338 0.0876964 0.0683322 0.0612340 0.0588235 0.0557159 0.0500585 0.0471207 0.0474391 0.0293175 0.0410056 0.0558908 0.0368372 0.0360733 0.0331288 0.0377095 0.0357581 0.0363993 0.0433144 0.0387297 0.0345015
Liberia 15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0291927 0.0663223 0.0319106 0.0150259 0.0107928 0.0171671 0.0170524 0.0188509 0.0184659 0.0149619 0.0143304 0.0129136 0.0126500 0.0121674 0.0130385 0.0150916
Madagascar NA NA 0.0902622 0.0615541 0.0723283 0.0790887 0.0384180 0.0545232 0.0469001 0.0488251 0.0696400 0.0852813 0.0676783 0.0680194 0.0664531 0.0781128 0.0867164 0.0687030 0.0495604 0.0502326 0.0456305 0.0597508 0.0612872 0.0590110 0.0464325 0.0517556 0.0514743 0.0455484 0.0443172 0.0399465 0.0370149 0.0338783 0.0370779 0.0329681
Malawi NA July-June NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0218163 0.0189223 0.0262220 0.0427184 0.0310787 0.0259756 0.0287527 0.0335848 0.0261120 0.0275671 0.0288717 0.0384803 0.0314215 0.0229670 0.0228862 0.0251736 0.0306123 0.0327963
Mali NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0762513 0.0706110 0.0636355 0.0681910 0.0653527 0.0639860 0.0630414 0.0630550 0.0772723 0.0621247 0.0678424 0.0603565 0.0770329 0.0588071 0.0759519 0.1127183 0.1161869 0.1321343 0.1390426 0.1080746
Mauritania NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1246774 0.1064662 0.1100055 NA 0.1195410 0.1240468 NA NA 0.0981696 0.0992879 0.0915216 0.0840176 0.1029737 0.1044952 0.1122329 0.1067889
Mauritius NA NA NA NA 0.0144858 0.0170259 0.0167451 0.0170506 0.0144643 0.0145733 0.0137993 0.0111141 0.0099034 0.0096869 0.0085313 0.0082101 0.0079661 0.0075426 0.0069647 0.0068860 0.0068506 0.0065417 0.0067795 0.0065823 0.0061013 0.0063177 0.0062498 0.0078233 0.0065565 0.0058186 0.0071380 0.0069511 0.0064307 0.0059658
Mozambique 16 NA 0.1112957 0.1247881 0.1139130 0.1075157 0.1011463 0.0996966 0.1073694 0.0582787 0.0600915 0.0521001 0.0593848 0.0576079 0.0542925 0.0431382 0.0483016 0.0487918 0.0550479 0.0413284 0.0299903 0.0303403 0.0304278 0.0267571 0.0326538 0.0281358 0.0295494 0.0288669 0.0240930 0.0257078 0.0316136 0.0328963 0.0374611 0.0241693
Namibia 17 April-March NA NA NA 0.1543436 0.1152287 0.0685146 0.0561182 0.0583314 0.0552708 0.0658299 0.0658391 0.0868515 0.0778847 0.0880922 0.0870238 0.0837180 0.0882774 0.0946420 0.0945975 0.1000918 0.1104913 0.1055740 0.1050154 0.0929145 0.0903661 0.0837000 0.1035088 0.1036776 0.0950873 0.0924684 0.0913571 0.0853846
Niger NA NA NA NA NA NA NA NA NA 0.0618849 0.0655714 0.0577737 0.0612226 0.0618680 0.0657719 0.0738717 0.0517392 0.0519311 0.0527285 0.0482538 NA NA 0.0438355 0.0410353 0.0567209 0.0674825 0.0950963 0.0508592 0.0569637 NA 0.0829833 0.0927684 0.0847798 0.0623518
Nigeria 18 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0219681 0.0252880 0.0492407 0.0245931 0.0267724 0.0223122 0.0281378 0.0204780 0.0340229 0.0327000 0.0323966 0.0333826 0.0357621 0.0351169 0.0328006 0.0377149 0.0456183 0.0358655 0.0388858 0.0363580
Rwanda 19 NA NA NA NA NA 0.1780803 0.1976951 0.2143663 0.2132780 0.2372031 0.2114395 0.2313083 0.1675967 0.1625906 0.1517524 0.1270681 0.1142357 0.0970442 0.0768670 0.0798493 0.0609444 0.0581527 0.0594483 0.0510559 0.0443508 0.0424262 0.0403252 0.0401331 0.0456566 0.0493672 0.0497728 0.0468238 0.0443462
Senegal § ¶ 20 NA NA NA NA NA NA NA 0.0876613 0.0929979 0.0823426 0.0858352 0.0873767 0.0812268 0.0743594 0.0674322 0.0687296 0.0648537 0.0589286 0.0605530 0.0597202 0.0622224 0.0617027 0.0632559 0.0560084 0.0556464 0.0484722 0.0566630 0.0525259 0.0526475 0.0668564 0.0669385 0.0738706 0.0629918
Seychelles NA NA 0.0915966 0.0827897 0.0874172 0.0848837 0.0932504 0.0452767 0.0384026 0.0429572 0.0354533 0.0369864 0.0285517 0.0317184 0.0303030 0.0379707 0.0297798 0.0388595 0.0475570 0.0411168 0.0324593 0.0350448 0.0426124 0.0317878 0.0213432 0.0235426 0.0242640 0.0274289 0.0681072 0.0406134 0.0407480 0.0397342 0.0381438 0.0354023
Sierra Leone 21 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1535562 0.1435982 0.1081062 0.1091169 0.0874874 0.0791123 0.0893567 0.1039878 0.0583932 0.0615721 0.0480768 0.0402625 0.0384989 0.0411362 0.0551583 0.0445229 0.0478144 0.0452271 0.0338447 0.0291470
Somalia 22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
South Africa 23 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0550455 0.0588311 0.0615902 0.0577644 0.0533514 0.0491167 0.0467787 0.0433312 0.0399645 0.0382854 0.0354826 0.0357308 0.0361136 0.0355514 0.0348519 0.0333817 0.0327750 0.0319585 0.0298256 0.0276706
South Sudan 24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.2897360 0.2774067 0.2593188 0.2367723 0.2556026 0.0896980 0.0624362 0.0992026 0.1038421
Sudan ‡ 25 NA NA NA 0.1709677 0.1172840 0.1177632 0.2075758 0.1937870 0.1608782 0.1364103 0.1293031 0.3054418 0.4775528 0.4315519 0.2503116 0.2534764 0.1486197 0.2820129 0.1676611 0.1934025 0.2085061 0.2525845 0.2907984 NA NA NA NA NA 0.2192028 0.2317864 0.2551963 0.1175486 0.0922759
eSwatini ‡ 26 April-March 0.0558451 0.0536300 0.0632302 0.0632332 0.0583659 0.0681239 0.0664431 0.0749103 0.0639747 0.0637466 0.0654926 0.0568370 0.0571994 0.0496481 0.0485678 0.0567626 0.0496579 0.0648269 0.0648674 0.0587851 0.0606203 0.0633557 0.0747897 0.0874464 0.0687691 0.0656285 0.0576134 0.0536139 0.0578371 0.0527550 0.0538422 0.0547098
Tanzania NA NA NA NA NA 0.1268485 0.0986493 0.0692140 0.0636070 0.0860272 0.0957490 0.0989717 0.1028514 0.0855057 0.0885937 0.0965784 0.0788169 0.0575808 0.0481131 0.0443520 0.0443201 0.0427026 0.0382834 0.0380806 0.0448911 0.0478507 0.0468552 0.0516053 0.0587534 0.0636338 0.0646747 0.0692006 0.0744216 0.0759329
Togo NA NA NA 0.1076475 0.1086618 0.1148253 0.1351604 0.1549373 0.1134581 0.1084423 NA NA NA NA NA NA NA 0.1139687 0.0987094 0.0815396 NA NA 0.1008876 0.0820386 0.0794338 0.0598619 0.0608670 0.0628706 0.0660965 0.0546220 0.0590409 0.0860232 0.0790456 0.1221015
Uganda NA NA NA NA NA NA NA NA NA NA NA 0.1197991 0.1347415 0.1387687 0.1196289 0.1072322 0.1006896 0.1061151 0.1169393 0.1201656 0.1133407 0.1088035 0.1074510 0.1035712 0.1598836 0.1675728 0.0866932 0.0697706 0.0641870 0.0626589 0.0632803 0.0688476 0.0718800 0.0870452
Zambia NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0679289 0.0745749 0.0819467 0.0829423 0.0797840 0.0809555 0.0765302 0.0674765 0.0630795 0.0570427 0.0661661 0.0619325 0.0587362 0.0516669 0.0517042 0.0497967
Zimbabwe 27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0926657 0.2326619 NA NA NA 0.0451299 0.0605548 0.0911432 0.0893090 0.0923251 0.0919397 0.0736305 0.0551989 0.0560710 0.0320579
Central America and the Caribbean NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Belize NA April-March NA NA NA NA NA NA NA NA 0.0468581 0.0539943 NA NA 0.0270062 0.0246028 0.0260131 0.0264775 0.0298776 0.0343300 0.0382054 0.0338477 0.0483662 0.0436600 0.0375453 0.0357686 0.0345889 0.0377071 0.0375790 0.0322711 0.0346851 0.0353089 0.0384618 0.0371649
Costa Rica 28 NA NA NA 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Cuba 29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Dominican Rep. NA NA NA NA NA NA NA NA NA NA NA 0.0564165 0.0586423 0.0578993 0.0708547 0.0771285 0.0668306 0.0401896 0.0402640 0.0506180 0.0422925 0.0385683 0.0382737 0.0410790 0.0422519 0.0378083 0.0324666 0.0345844 0.0383419 0.0386443 0.0373958 0.0386392 0.0420785 0.0399413
El Salvador 30 NA NA NA 0.2282544 0.1562187 0.1185457 0.1030708 0.0854176 0.0748233 0.0610974 0.0675974 0.0578146 0.0539970 0.0438674 0.0594990 0.0609729 0.0429007 0.0442600 0.0417007 0.0400507 0.0443255 0.0419597 0.0429444 0.0435065 0.0442995 0.0431678 0.0442025 0.0436136 0.0448732 0.0431134 0.0437165 0.0469274 0.0485046
Guatemala NA NA NA NA NA NA NA NA NA 0.1153824 0.0950564 0.0695694 0.0576142 0.0488039 0.0641235 0.0725043 0.0549532 0.0539095 0.0357450 0.0279825 0.0294327 0.0279011 0.0311907 0.0275252 0.0282774 0.0287249 0.0317715 0.0336766 0.0312337 0.0322670 0.0350555 0.0300409 0.0282461 0.0338517
Haiti 31 NA NA NA NA NA NA NA NA NA NA 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000503 0.0000445 0.0000000
Honduras 32 NA NA NA 0.0830825 0.0543807 NA 0.0345204 NA NA NA NA NA NA 0.0330307 0.0328179 0.0301837 0.0377539 0.0267265 0.0271703 0.0283858 0.0317403 0.0361231 0.0379136 0.0406018 0.0436599 0.0434823 0.0541431 0.0560334 0.0642258 0.0607943 0.0641061 0.0606846 0.0602029
Jamaica NA April-March NA NA 0.0313702 0.0296820 0.0531517 0.0370462 0.0284446 0.0226703 0.0198749 0.0224809 0.0186695 0.0171162 0.0179736 0.0172309 0.0183768 0.0174410 0.0165668 0.0175623 0.0190467 0.0201485 0.0269971 0.0239430 0.0259213 0.0284692 0.0305933 0.0325727 0.0320805 0.0314253 0.0334045 0.0334151 0.0446912 0.0533537
Mexico NA NA NA NA 0.0171881 0.0196853 0.0224321 0.0219526 0.0251364 0.0218009 0.0209419 0.0201204 0.0208432 0.0208703 0.0210723 0.0207545 0.0197960 0.0179824 0.0170254 0.0160903 0.0137873 0.0170104 0.0140811 0.0180449 0.0163593 0.0168051 0.0168707 0.0182853 0.0183797 0.0169724 0.0180996 0.0169811 0.0186070 0.0200380
Nicaragua 33 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0292533 0.0273208 0.0355028 0.0316781 0.0270130 0.0253485 0.0257822 0.0247309 0.0229294 0.0221018 0.0223776 0.0223687 0.0276482 0.0280386 0.0278637 0.0303435 0.0238825 0.0231640 0.0228074 0.0238203
Panama 34 NA 0.0548507 0.0526887 0.0360809 0.0699288 0.0464623 0.0421799 0.0486278 0.0433962 0.0545553 0.0498521 0.0375858 0.0382192 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Trinidad & Tobago NA October-Sept. NA NA NA NA 0.0162454 0.0192286 0.0193107 NA NA NA NA NA 0.0056570 0.0072515 0.0090897 0.0265010 0.0277510 0.0270821 0.0210890 0.0225342 0.0169411 0.0169046 0.0186539 0.0188959 0.0265477 0.0197766 0.0217817 0.0356447 0.0274943 0.0276055 0.0230664 0.0495078
Canada NA NA 0.0434083 0.0418689 0.0398191 0.0359879 0.0345699 0.0344489 0.0336952 0.0317271 0.0297895 0.0279086 0.0281558 0.0289732 0.0274757 0.0275741 0.0276495 0.0276082 0.0282151 0.0287406 0.0290352 0.0307845 0.0321214 0.0317257 0.0277341 0.0287020 0.0273273 0.0250838 0.0257991 0.0288045 0.0286710 0.0335739 0.0326536 0.0315031
USA 35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0955976 0.1027500 0.1129688 0.1196848 0.1205394 0.1199646 0.1178709 0.1197200 0.1177779 0.1233446 0.1244421 0.1202205 0.1125081 0.1042062 0.0989399 0.0964224 0.0940025 0.0943720 0.0943063
Argentina 36 NA NA NA NA NA NA NA NA 0.0576285 0.0489338 0.0451497 0.0439388 0.0428520 0.0406980 0.0400710 0.0446886 0.0430795 0.0383548 0.0346832 0.0296143 0.0268200 0.0247951 0.0256777 0.0244282 0.0218981 0.0213144 0.0222785 0.0226006 0.0205512 0.0194895 0.0206159 0.0190061 0.0186513
Bolivia 37 NA 0.0842830 0.0883535 0.1236451 0.1111831 0.0992439 0.0705054 0.0840746 0.0813117 0.0762790 0.0803957 0.0897848 0.0726476 0.0703718 0.0708767 0.0609581 0.0670777 0.0595155 0.0534189 0.0525460 0.0516524 0.0555362 0.0556708 0.0528978 0.0476331 0.0512121 0.0479018 0.0438507 0.0391080 0.0407706 0.0398024 0.0414240 0.0389586
Brazil NA NA NA NA NA NA NA NA NA NA 0.0432647 0.0408718 0.0406424 0.0415643 0.0501923 0.0538701 0.0487155 0.0366784 0.0382844 0.0383298 0.0377886 0.0389784 0.0385430 0.0414735 0.0385891 0.0375737 0.0370328 0.0355032 0.0345367 0.0354848 0.0340079 0.0369416 0.0391864 0.0385566
Chile § 38 NA NA NA 0.1485286 0.1282108 0.1206297 0.1225624 0.1238323 0.1270579 0.1174370 0.1201875 0.1176058 0.1140737 0.1175607 0.1141892 0.1091109 0.1216552 0.1302995 0.1251791 0.1337993 0.1207349 0.1185645 0.0911489 0.0960098 0.0989199 0.0886128 0.0861578 0.0824681 0.0763010 0.0758534 0.0761248 0.0733456 0.0717816
Colombia 39 NA 0.1086022 0.0887780 0.0910072 0.0897705 0.0974865 0.1080205 0.1020486 0.1067697 0.1484107 0.0895809 0.1093292 0.1114379 0.1147224 0.1207032 0.1224904 0.1244374 0.1311461 0.1303851 0.1158613 0.1165573 0.1392630 0.1308630 0.1235314 0.1069949 0.1120234 0.1133612 0.1056531 0.1052827 0.1107104 0.1141651 0.1089636 0.1103261
Ecuador 40 NA NA NA NA NA NA NA NA 0.0984456 0.0801300 0.0878985 0.0969793 0.0649408 0.0625441 0.0776228 0.0819672 0.1121907 0.0947551 0.1074324 0.0956890 0.1064608 0.0756399 0.0945657 0.0868051 0.0784180 0.0731699 0.0657540 0.0628359 0.0659300 0.0652102 0.0646734 0.0634716 0.0655075
Guyana ‡ 41 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0367531 0.0397842 0.0463287 0.0436868 0.0564661 0.0381014 0.0348319 0.0440767 0.0507662 0.0467074 0.0444782 0.0410614 0.0375205 0.0391024 0.0408911 0.0495765 0.0455964 0.0473840 0.0467613 0.0448382
Paraguay 42 NA 0.3476039 0.2174924 0.2303818 0.2513852 0.1842148 0.1707627 0.1401963 0.1427033 0.1195042 0.0915731 0.0814038 0.0672762 0.0625856 0.0556741 0.0539754 0.0510038 0.0557124 0.0486511 0.0520909 0.0525723 0.0532797 0.0495535 0.0508244 0.0532855 0.0516175 0.0545833 0.0549240 0.0521824 0.0488761 0.0458463 0.0485377 0.0530713
Peru 43 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0832697 0.0846367 0.0791937 0.0757014 0.0712965 0.0795280 0.0770445 0.0701300 0.0631855 0.0711061 0.0698259 0.0697691 0.0729335 0.0758620 0.0703253 0.0772663 0.0619502 0.0586899 0.0548839 0.0543445
Uruguay NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0806240 0.0840528 0.0824603 0.0840280 0.0739570 0.0702876 0.0697892 0.0685471 0.0608904 0.0651753 0.0614348 0.0627507 0.0598725 0.0597323 0.0577614 0.0569402 0.0585693 0.0576525 0.0603864 0.0642603 0.0601684
Venezuela 44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Asia & Oceania NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Kazakhstan † 45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0486349 0.0482286 0.0464775 0.0470927 0.0494447 0.0547100 0.0426576 0.0469973 0.0451385 0.0441046 0.0477777 0.0544250 0.0489972 0.0485224 0.0433796 0.0345358 0.0465286 0.0501099
Kyrgyzstan 46 NA NA NA NA NA NA NA NA 0.0472740 0.0541025 0.0566072 0.0442717 0.0516025 0.0623091 0.0517793 0.0550288 0.0604303 0.0591535 0.0555433 0.0571812 0.0452377 0.0426478 0.0440394 0.0434157 0.0373166 0.0401139 0.0425290 0.0439798 0.0457760 0.0425512 0.0411389 0.0460574 0.0410119
Tajikistan NA NA NA NA NA NA NA NA NA NA NA NA 0.1021047 0.0793347 0.0621272 0.0640195 0.1101246 0.1172907 0.1072000 NA NA NA 0.0376097 0.0333333 0.0364566 0.0404700 0.0407053 NA 0.0395633 0.0382056 NA NA NA NA
Turkmenistan 47 NA NA NA NA NA NA NA NA NA NA 0.1583309 0.1281765 0.1496144 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Uzbekistan 48 NA NA NA NA NA NA NA 0.0449555 0.0300819 0.0280805 0.0351447 NA 0.0388327 0.0279681 0.0217500 0.0137718 0.0136315 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
China 49 NA NA 0.1338489 0.1396720 0.1447360 0.1711013 0.1505580 0.1435034 0.1542852 0.1525425 0.1445887 0.1343870 0.1285911 0.1169191 0.1198481 0.1187398 0.1163016 0.1158249 0.1097672 0.1095632 0.1053803 0.0837598 0.0809191 0.0764204 0.0679029 0.0654537 0.0654268 0.0657989 0.0609958 0.0604420 0.0589204 0.0556207 0.0540382
Japan 50 NA 0.0301965 0.0308125 0.0306864 0.0306742 0.0298526 0.0283624 0.0276430 0.0269642 0.0264416 0.0273329 0.0238985 0.0261418 0.0254728 0.0262835 0.0262344 0.0264484 0.0270857 0.0269257 0.0269157 0.0263944 0.0263203 0.0248986 0.0248735 0.0250342 0.0245705 0.0240811 0.0248656 0.0252291 0.0248782 0.0249439 0.0252851 0.0251755
Korea, North 51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Korea, South 52 NA NA NA NA NA NA NA NA 0.2030608 0.1851358 0.1816396 0.1641663 0.1452651 0.1441779 0.1345963 0.1365656 0.1217344 0.1170678 0.1256150 0.1228355 0.1207365 0.1250409 0.1279446 0.1322032 0.1296777 0.1270843 0.1257495 0.1280488 0.1264042 0.1262125 0.1233071 0.1224969 0.1208088
Mongolia NA NA 0.1395998 0.1258700 0.0915417 0.0853518 0.0724248 0.0475639 0.0550309 0.0551006 0.0560997 0.0513371 0.0489557 0.0513325 0.0618147 0.0518326 0.0509936 0.0453088 0.0437779 0.0470195 0.0438250 0.0378350 0.0315461 0.0231572 0.0241643 0.0220731 0.0256326 0.0255767 0.0267464 0.0280816 0.0217734 0.0236863 0.0257037 0.0231790
Taiwan NA NA 0.2252866 0.1619898 0.1841071 0.1648290 0.1608341 0.1716513 0.1644634 0.1475613 0.1483780 0.1378149 0.1213709 0.1381655 0.0823828 0.1095485 0.1110019 0.1061587 0.1062422 0.1022838 0.1014272 0.1053745 0.1089943 0.1034408 0.1015749 0.1022107 0.1052223 0.1002460 0.1009569 0.1056524 0.1015839 0.1026527 0.0996466 0.1018844
Afghanistan 53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1613434 0.1268976 0.1036038 0.1194840 0.1116541 0.0986039 0.0935460 0.0830276 0.0469637 0.0431176 0.0510979 0.0383314 0.0368025 0.0365259 0.0372486 0.0416099
Bangladesh 54 July-June 0.1033377 0.1045006 0.1028201 0.1042656 0.1158163 0.1115832 0.1182608 0.1144236 0.1198728 0.1226547 0.1232689 0.1415816 0.1230970 0.1051397 0.1012357 0.0987597 0.1010515 0.0947922 0.0977436 0.1035752 0.0813035 0.0972939 0.1117228 0.1045518 0.0994524 0.0913186 0.0972599 0.1051398 0.1092106 0.0978248 0.0957301 0.0971165
India 55 April-March 0.1477827 0.1356620 0.1240058 0.1085752 0.1031230 0.1096860 0.1034574 0.1050325 0.1032728 0.1067790 0.1065951 0.1164056 0.1150306 0.1052395 0.0987956 0.0910012 0.1011743 0.1042313 0.0947842 0.0885118 0.0888878 0.1031474 0.0986423 0.0959277 0.0927262 0.0929598 0.0950479 0.0883120 0.0908015 0.0917715 0.0910243 0.0882739
Nepal July-June NA NA NA NA NA NA NA NA NA NA NA NA 0.0687332 0.0746249 0.0976813 0.1167397 0.1332449 0.1403686 0.1372883 0.1035209 0.1047510 0.0849528 0.0833125 0.0826333 0.0741697 0.0865233 0.0864581 0.0774278 0.0774928 0.0628302 0.0482152 0.0450514
Pakistan ‡ 56 July-June NA NA NA NA NA 0.2510169 0.2739593 0.2720623 0.2457583 0.2503728 0.2344689 0.2397516 0.2242282 0.2403239 0.2256930 0.2541437 0.2605786 0.2445056 0.2136511 0.1802775 0.1613347 0.1694049 0.1683467 0.1698074 0.1608995 0.1590651 0.1730047 0.1796239 0.1803222 0.1771763 0.1875828 0.1843488
Sri Lanka NA NA NA NA 0.0750666 0.0953402 0.1195253 0.1210230 0.1264669 0.1934443 0.1953277 0.1768114 0.1775699 0.1606030 0.1893193 0.1563796 0.1358321 0.1253645 0.1315083 0.1107553 0.1152768 0.1386731 0.1644044 0.1455771 0.1353040 0.1351539 0.1209138 0.1251708 0.1351058 0.1254365 0.1086662 0.1105405 0.1014463 0.1035963
Brunei 57 NA 0.1323258 0.1251293 0.1469144 0.1524083 0.1335070 0.1103006 0.0927214 0.0908683 0.1236645 0.1344455 0.1210034 0.1012951 0.0979525 0.0988593 0.0843223 0.1084399 0.0689444 0.0810163 0.0824929 0.0811937 0.0835369 0.0844258 0.0787859 0.0754731 0.0696625 0.0678153 0.0905518 0.0847866 0.0899423 0.0783288 0.0819911 0.0945338
Cambodia NA NA NA NA NA NA NA NA NA NA 0.2067331 0.2418726 0.1985745 0.1818056 0.1468827 0.1172830 0.0900256 0.0919119 0.0935285 0.0914366 0.0805335 0.0634989 0.0518921 0.0643702 0.0714281 0.0727274 0.0713190 0.0748297 0.0766275 0.0888738 0.0904132 0.0935943 0.0902528 0.0906393
Indonesia 58 NA NA NA NA NA NA 0.0718535 0.0774869 0.0852386 0.0909332 0.0812869 0.0559369 0.0443230 0.0411253 0.0269952 0.0380243 0.0459959 0.0487584 0.0395903 0.0356151 0.0380345 0.0298518 0.0335440 0.0365733 0.0369092 0.0377764 0.0481506 0.0418061 0.0504782 0.0470893 0.0522394 0.0435964 0.0412704
Laos NA October-Sept. NA NA NA NA NA NA NA NA NA NA NA NA 0.0384915 0.0358383 0.0351353 0.0306845 0.0319620 0.0255991 0.0233158 0.0206622 0.0170561 0.0108040 0.0091316 0.0105068 0.0080689 0.0078341 NA NA NA NA NA NA
Malaysia 59 NA NA NA 0.0780236 0.1072332 0.0972027 0.1072550 0.1123403 0.1117909 0.0984388 0.0905156 0.0637701 0.0782996 0.0585551 0.0678268 0.0750640 0.0855322 0.0802742 0.0845817 0.0749445 0.0756508 0.0677875 0.0605871 0.0560135 0.0573266 0.0495812 0.0539701 0.0552735 0.0608666 0.0609902 0.0510183 0.0426189 0.0444858
Myanmar 60 April-March NA NA NA NA NA NA NA NA NA NA 0.1048387 0.0976537 0.1120463 0.1062394 0.1006708 0.1502324 0.1372737 0.1186302 NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Philippines 61 NA NA 0.1248324 0.1001468 0.0977428 0.0969261 0.1074915 0.0966829 0.1051628 0.1011985 0.0825740 0.0808981 0.0754671 0.0748423 0.0676516 0.0691876 0.0732468 0.0675598 0.0681867 0.0688697 0.0710207 0.0699127 0.0625907 0.0637736 0.0672745 0.0612719 0.0666056 0.0602717 0.0607152 0.0560568 0.0654236 0.0394635 0.0448929
Singapore NA April-March NA NA 0.2991664 0.2751142 0.2964957 0.2717384 0.3299228 0.2937948 0.2316956 0.3035755 0.2926454 0.3183576 0.2742937 0.2649810 0.3042630 0.3012152 0.3056253 0.3369771 0.3092842 0.3922256 0.2795046 0.2340681 0.3220090 0.3262851 0.3140360 0.2760096 0.2386906 0.2095495 0.1995955 0.2162514 0.2022371 0.2138229
Thailand NA October-Sept. NA NA NA NA NA NA NA 0.1366623 0.1231982 0.1007056 0.0781805 0.0637702 0.0804209 0.0721419 0.0566638 0.0695689 0.0574814 0.0546840 0.0598181 0.0687285 0.0793444 0.0801965 0.0672686 0.0700117 0.0651525 0.0651111 0.0638753 0.0650428 0.0677278 0.0643361 0.0638096 0.0625718
Timor-Leste 62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0304815 0.0628860 0.0576092 0.0298247 0.0411749 0.0246626 0.0147804 0.0222438 0.0236088 0.0184458 0.0237069 0.0144765 0.0185437 0.0153462 0.0219528
Viet Nam 63 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0755297 0.0749014 0.0680052 0.0743459 0.0819878 0.0796679 0.0716693 0.0767920 0.0733397 NA NA NA NA NA NA NA NA
Australia NA NA 0.0704352 0.0691502 0.0679191 0.0654926 0.0636202 0.0638109 0.0626089 0.0600409 0.0576108 0.0568630 0.0538823 0.0520877 0.0518288 0.0523376 0.0535459 0.0528148 0.0523522 0.0519950 0.0526489 0.0528442 0.0512611 0.0509118 0.0502028 0.0483693 0.0456899 0.0449406 0.0481012 0.0522244 0.0557791 0.0544128 0.0516376 0.0511631
Fiji † 64 NA NA NA NA NA 0.0694402 0.0702703 0.0701138 0.0702158 0.0539813 0.0469045 0.0470157 0.0488542 0.0706736 0.0691027 0.0565217 0.0575733 0.0660962 0.0567315 0.0647751 0.0879335 0.0621091 0.0629630 0.0596914 0.0587918 0.0539715 0.0510740 0.0529449 0.0305521 0.0403369 0.0477852 0.0459393 0.0502112
New Zealand NA NA 0.0458783 0.0454922 0.0466739 0.0429861 0.0399099 0.0413509 0.0433186 0.0442592 0.0449398 0.0436953 0.0426047 0.0419757 0.0416703 0.0402772 0.0380720 0.0375684 0.0350374 0.0330672 0.0352927 0.0343228 0.0323399 0.0334727 0.0309053 0.0294397 0.0301208 0.0295550 0.0302210 0.0297363 0.0309097 0.0320568 0.0341172 0.0391877
Papua New Guinea ‡ 65 NA 0.0447991 0.0453532 0.0588341 0.0420302 0.0397328 0.0396338 0.0534264 0.0461573 0.0589166 0.0532093 0.0446514 0.0328040 0.0317811 0.0258230 0.0186393 0.0188442 0.0200102 0.0201407 0.0192710 0.0228387 0.0170602 0.0181703 0.0176768 0.0181298 0.0231728 0.0179038 0.0178983 0.0200887 0.0182508 0.0193243 0.0153675 0.0158162
Albania § ¶ 66 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0473438 0.0542899 0.0622608 0.0625620 0.0464273 0.0530374 0.0528386 0.0526790 0.0482649 0.0424378 0.0382627 0.0378723 0.0380518 0.0399130 0.0428939
Bosnia-Herzegovina † ¶ 67 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0755265 0.0503363 0.0432063 0.0346768 0.0313458 0.0273448 0.0252302 0.0281081 0.0258874 0.0245007 0.0244406 0.0241657 0.0222141 0.0230364 0.0221351 0.0212432 0.0207955 0.0226082
Bulgaria † 68 NA NA NA NA NA NA NA NA NA NA NA 0.0696468 0.0724462 0.0714354 0.0784747 0.0792535 0.0752499 0.0685835 0.0656793 0.0640533 0.0672976 0.0637285 0.0515093 0.0475326 0.0411218 0.0408945 0.0409940 0.0353182 0.0333762 0.0380092 0.0381598 0.0422278 0.0840762
Croatia 69 NA NA NA NA NA 0.1997090 0.2905618 0.2393405 0.2121661 0.1822415 0.1692817 0.1145226 0.0871325 0.0643767 0.0592918 0.0541225 0.0410202 0.0360563 0.0376449 0.0362849 0.0358207 0.0406026 0.0372858 0.0353836 0.0365599 0.0353482 0.0345318 0.0383455 0.0368904 0.0342746 0.0369313 0.0342231 0.0357883
Czechia NA NA NA NA NA NA NA NA NA 0.0336735 0.0401653 0.0381232 0.0416772 0.0449456 0.0458287 0.0405347 0.0407118 0.0383577 0.0402704 0.0423457 0.0381054 0.0354412 0.0304701 0.0298313 0.0276677 0.0252231 0.0240742 0.0240866 0.0229389 0.0228466 0.0253824 0.0248739 0.0272227 0.0287919
Czechoslovakia 70 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Estonia NA NA NA NA NA NA NA NA NA 0.0235247 0.0224191 0.0287241 0.0271537 0.0314825 0.0378307 0.0428805 0.0461703 0.0495431 0.0495050 0.0429796 0.0414799 0.0490832 0.0447265 0.0390299 0.0420432 0.0448862 0.0482338 0.0495879 0.0508430 0.0510690 0.0525885 0.0516498 0.0506604 0.0532727
German DR 71 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Hungary NA NA NA NA NA NA NA NA NA 0.0239221 0.0246786 0.0297836 0.0250570 0.0294391 0.0321485 0.0333351 0.0313737 0.0335633 0.0304080 0.0286218 0.0237913 0.0255128 0.0243916 0.0224552 0.0209234 0.0211142 0.0213091 0.0191780 0.0174622 0.0183719 0.0218574 0.0223774 0.0247571 0.0263393
Kosovo NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0006720 0.0179152 0.0240134 0.0269395 0.0234843 0.0246311 0.0273589 0.0287441 0.0278706 0.0288502 0.0275357 0.0274115
Latvia 72 NA NA NA NA NA NA NA NA NA NA NA 0.0158744 0.0191075 0.0243450 0.0303160 0.0450122 0.0488564 0.0476615 0.0466752 0.0506388 0.0470714 0.0446389 0.0324851 0.0253952 0.0268553 0.0244562 0.0251531 0.0249608 0.0277427 0.0401418 0.0436726 0.0552352 0.0556287
Lithuania NA NA NA NA NA NA NA 0.0219588 0.0135480 0.0137383 0.0157116 0.0229183 0.0333903 0.0245805 0.0339209 0.0388742 0.0383307 0.0349657 0.0360279 0.0347709 0.0345027 0.0322942 0.0305189 0.0247718 0.0213266 0.0190760 0.0217708 0.0220270 0.0258593 0.0330739 0.0443707 0.0531034 0.0596905 0.0587094
Montenegro 73 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0705628 0.0538462 0.0397795 0.0366330 0.0359141 0.0388889 0.0386333 0.0362448 0.0316885 0.0332963 0.0302471 0.0296993 0.0288748 0.0303459 0.0363371
North Macedonia 74 NA NA NA NA NA NA NA NA NA NA 0.0646348 0.0639474 0.0516570 0.0577937 0.1632785 0.0692703 0.0650477 0.0697636 0.0624566 0.0583900 0.0620079 0.0516070 0.0502997 0.0425141 0.0396220 0.0368440 0.0369261 0.0344626 0.0308304 0.0311886 0.0281784 0.0311553 0.0370991
Poland NA NA NA NA NA NA NA NA NA 0.0409832 0.0385819 0.0438254 0.0456094 0.0450123 0.0435052 0.0423031 0.0418628 0.0416677 0.0429740 0.0433861 0.0429897 0.0463307 0.0395406 0.0398998 0.0400344 0.0407480 0.0419066 0.0415402 0.0447431 0.0513161 0.0472171 0.0459722 0.0494668 0.0472635
Romania NA NA NA NA 0.1182121 0.1237647 0.1012253 0.0811078 0.0931671 0.0797686 0.0732681 0.0899580 0.0848993 0.0756729 0.0716781 0.0735744 0.0714628 0.0679840 0.0606443 0.0621336 0.0544972 0.0432116 0.0396918 0.0351962 0.0327793 0.0353221 0.0350769 0.0378192 0.0399198 0.0424647 0.0448782 0.0558939 0.0564604 0.0608248
Serbia 75 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1643193 0.1191235 0.0981295 0.0822888 0.0728252 0.0571106 0.0512450 0.0533337 0.0498207 0.0504306 0.0486726 0.0481229 0.0436730 0.0449214 0.0433129 0.0428085 0.0417383 0.0458439 0.0396904 0.0539139
Slovakia NA NA NA NA NA NA NA NA 0.0655132 0.0560199 0.0471494 0.0382748 0.0328795 0.0318187 0.0415097 0.0393451 0.0461357 0.0436848 0.0422730 0.0411864 0.0407542 0.0395683 0.0344388 0.0301615 0.0265714 0.0268788 0.0237173 0.0235118 0.0249131 0.0269387 0.0274137 0.0299623 0.0434771
Slovenia NA NA NA NA NA NA NA NA NA 0.0396621 0.0396153 0.0356064 0.0338912 0.0298925 0.0267898 0.0312121 0.0336782 0.0337821 0.0342711 0.0336812 0.0367424 0.0363694 0.0366662 0.0351332 0.0349224 0.0281500 0.0262244 0.0193578 0.0207462 0.0212537 0.0246116 0.0246917 0.0248287 0.0265011
Yugoslavia 76 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Armenia † 77 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1445281 0.1473773 0.1357100 0.1527066 0.1455882 0.1628077 0.1543779 0.1598841 0.1679748 0.1643710 0.1609987 0.1512266 0.1479148 0.2085990 0.1976987
Azerbaijan 78 NA NA NA NA NA NA NA 0.0802326 0.1467337 0.1140741 0.1150470 0.1338710 0.1346467 0.1242741 0.1377803 0.0969351 0.1120155 0.1085673 0.1022013 0.1350833 0.1098742 0.1046834 0.0963696 0.0873333 0.1384348 0.1271590 0.1201947 0.1252259 0.1412855 0.1042616 0.1055362 0.1074785 0.1132174
Belarus NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.3280212 0.3093829 0.2885784 0.2984615 0.3221011 0.3502197 0.3244939 0.2342896 0.2567715 0.3026605 0.3038934 0.3198343 0.3150362 0.3302486 0.3068832 0.3107331 0.2961902 0.3199164 0.3179736
Georgia † 79 NA NA NA NA NA NA NA NA NA 0.1169631 0.0556530 0.0585041 0.0454861 0.0353949 0.0428076 0.0608980 0.0646232 0.0708876 0.1502878 0.2240349 0.3221859 0.2608249 0.1565595 0.1180373 0.1116505 0.1050008 0.0948386 0.0840843 0.0728901 0.0733652 0.0693990 0.0684289 0.0660265
Moldova † ¶ NA NA NA NA NA NA NA NA 0.0220345 0.0209419 0.0196485 0.0159843 0.0154867 0.0113828 0.0136428 0.0136573 0.0124284 0.0103702 0.0107825 0.0119767 0.0120854 0.0146643 0.0101078 0.0077098 0.0083823 0.0081407 0.0086696 0.0086803 0.0093286 0.0112211 0.0104190 0.0104764 0.0110697
Russia 80 NA NA NA NA NA NA NA NA NA NA NA 0.0690552 0.0898860 0.1081963 0.1130253 0.1113849 0.1129226 0.1117038 0.1133632 0.1120654 0.0978734 0.0986316 0.1019202 0.1012230 0.1032146 0.1084156 0.1112218 0.1177220 0.1380998 0.1482840 0.1212886 0.1136213 0.1136893
Ukraine § 81 NA NA NA NA NA NA NA NA 0.0493084 0.0593795 0.0684749 0.0567867 0.0735339 0.0607362 0.0534122 0.0543923 0.0567204 0.0490703 0.0442288 0.0434111 0.0457410 0.0393644 0.0407608 0.0387051 0.0335587 0.0329435 0.0328270 0.0501413 0.0755324 0.0777905 0.0695561 0.0764803 0.0812152
Austria NA NA 0.0270275 0.0263571 0.0254509 0.0241118 0.0223902 0.0205751 0.0202628 0.0190123 0.0186221 0.0194612 0.0183072 0.0194447 0.0193159 0.0176504 0.0168193 0.0182318 0.0165791 0.0166192 0.0155983 0.0182864 0.0174591 0.0153928 0.0155432 0.0155407 0.0152005 0.0145375 0.0142911 0.0136813 0.0145876 0.0154374 0.0153307 0.0151366
Belgium NA NA 0.0463641 0.0446832 0.0427784 0.0406093 0.0323594 0.0300421 0.0302972 0.0293285 0.0286268 0.0282184 0.0278109 0.0276219 0.0273424 0.0259515 0.0245566 0.0239574 0.0234867 0.0211428 0.0216970 0.0226852 0.0241424 0.0214226 0.0203338 0.0191407 0.0185838 0.0180976 0.0176944 0.0171534 0.0170701 0.0171744 0.0173789 0.0179172
Cyprus 82 NA NA NA NA NA NA NA NA 0.0989293 0.1378911 0.1636998 0.1373997 0.0805389 0.0807018 0.0882786 0.0569179 0.0491519 0.0506164 0.0513344 0.0485623 0.0448465 0.0426428 0.0433721 0.0444362 0.0413046 0.0395004 0.0381712 0.0382648 0.0423642 0.0383211 0.0436688 0.0409222 0.0433112
Denmark NA NA 0.0364210 0.0351920 0.0348804 0.0346560 0.0329378 0.0315877 0.0293626 0.0287960 0.0283597 0.0289042 0.0290282 0.0286954 0.0276624 0.0290018 0.0283411 0.0273465 0.0268637 0.0255943 0.0276440 0.0263603 0.0268793 0.0238816 0.0246787 0.0232775 0.0233254 0.0219857 0.0208135 0.0203832 0.0218702 0.0224016 0.0252406 0.0256865
Finland 83 NA 0.0315286 0.0317038 0.0321511 0.0308883 0.0303336 0.0284776 0.0273640 0.0237209 0.0261878 0.0279495 0.0284896 0.0245055 0.0264233 0.0247270 0.0243058 0.0299363 0.0304566 0.0297754 0.0298871 0.0275835 0.0289048 0.0286156 0.0273963 0.0275438 0.0273308 0.0267962 0.0251593 0.0255929 0.0255587 0.0252052 0.0256456 0.0278539
France 84 NA 0.0587778 0.0584912 0.0562272 0.0551195 0.0514268 0.0489876 0.0489696 0.0457261 0.0442295 0.0437956 0.0422779 0.0415917 0.0403664 0.0392645 0.0387584 0.0393404 0.0397161 0.0379724 0.0373536 0.0362886 0.0355949 0.0367118 0.0346230 0.0336007 0.0327643 0.0323248 0.0325615 0.0329637 0.0338801 0.0338854 0.0330309 0.0333731
Germany 85 NA NA NA NA 0.0435222 0.0397952 0.0356325 0.0326432 0.0276240 0.0302176 0.0295741 0.0294109 0.0294799 0.0290138 0.0284566 0.0283306 0.0278094 0.0276554 0.0273176 0.0269196 0.0276940 0.0281795 0.0281622 0.0274320 0.0276080 0.0280674 0.0267430 0.0256966 0.0250135 0.0258707 0.0261957 0.0264381 0.0282842
Greece NA NA 0.1081018 0.0942777 0.0859184 0.0862375 0.0856576 0.0811759 0.0844884 0.0663823 0.0701546 0.0731004 0.0739816 0.0728098 0.0746431 0.0707043 0.0671961 0.0535265 0.0547242 0.0622585 0.0616937 0.0569224 0.0586691 0.0596330 0.0519652 0.0457968 0.0456362 0.0457163 0.0464964 0.0484423 0.0520051 0.0532072 0.0565263 0.0535589
Iceland † 86 NA 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Ireland NA NA 0.0246334 0.0258266 0.0273923 0.0275158 0.0259479 0.0258499 0.0253774 0.0248558 0.0253984 0.0253220 0.0238361 0.0221311 0.0225317 0.0216525 0.0191000 0.0178096 0.0171395 0.0162249 0.0151548 0.0141580 0.0137647 0.0127456 0.0088195 0.0117480 0.0122385 0.0124171 0.0123055 0.0118422 0.0120193 0.0118093 0.0114414 0.0114641
Italy 87 NA 0.0402132 0.0382905 0.0328923 0.0317847 0.0300308 0.0301006 0.0302928 0.0283342 0.0307608 0.0327808 0.0340396 0.0355369 0.0373516 0.0353415 0.0364676 0.0361731 0.0359252 0.0340483 0.0320280 0.0310274 0.0322158 0.0304649 0.0302028 0.0300965 0.0282892 0.0275363 0.0252926 0.0240850 0.0273158 0.0278993 0.0275994 0.0277050
Luxembourg 88 NA NA NA NA NA NA NA NA 0.0162007 0.0158102 0.0164933 0.0169385 0.0160749 0.0159436 0.0197095 0.0157048 0.0154494 0.0154374 0.0149767 0.0146927 0.0148691 0.0106774 0.0096151 0.0116749 0.0101081 0.0095086 0.0096708 0.0100581 0.0115187 0.0105643 0.0134143 0.0131282 0.0142567
Malta NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0146363 0.0150026 0.0146228 0.0138444 0.0158177 0.0194685 0.0154756 0.0150975 0.0146391 0.0165500 0.0163627 0.0142629 0.0126891 0.0126324 0.0121880 0.0122296 0.0142824 0.0141640 0.0125008 0.0148991
Netherlands NA NA 0.0492541 0.0491885 0.0473341 0.0442310 0.0430191 0.0389346 0.0377670 0.0334965 0.0376188 0.0366763 0.0358163 0.0368702 0.0346576 0.0341372 0.0333389 0.0330313 0.0334712 0.0337161 0.0330696 0.0326084 0.0308313 0.0298963 0.0281769 0.0280351 0.0268903 0.0255199 0.0258131 0.0258594 0.0271962 0.0272543 0.0289291 0.0313422
Norway 89 NA 0.0592284 0.0599967 0.0584387 0.0544719 0.0571735 0.0529065 0.0547356 0.0471944 0.0464046 0.0447175 0.0455080 0.0442840 0.0416191 0.0397394 0.0454583 0.0417470 0.0416202 0.0381216 0.0360470 0.0358696 0.0347751 0.0353242 0.0342112 0.0336348 0.0331386 0.0326213 0.0326034 0.0313193 0.0323524 0.0328343 0.0339211 0.0350292
Portugal NA NA 0.0576312 0.0586676 0.0559857 0.0512385 0.0485744 0.0496793 0.0509758 0.0529508 0.0491369 0.0480736 0.0442350 0.0444147 0.0434866 0.0433658 0.0438924 0.0416324 0.0427605 0.0438393 0.0431906 0.0408338 0.0405103 0.0404353 0.0382144 0.0400399 0.0394033 0.0418431 0.0346191 0.0371734 0.0447238 0.0368603 0.0422546 0.0441086
Spain 90 NA 0.0613359 0.0560650 0.0531524 0.0475309 0.0443093 0.0410597 0.0422949 0.0421014 0.0409874 0.0402787 0.0408146 0.0439532 0.0440540 0.0424616 0.0377113 0.0371110 0.0368893 0.0360796 0.0356378 0.0347565 0.0330315 0.0294031 0.0301753 0.0288794 0.0293478 0.0277894 0.0278198 0.0289679 0.0268396 0.0299063 0.0302298 0.0298379
Sweden 91 NA 0.0424576 0.0412640 0.0415691 0.0375814 0.0343441 0.0348768 0.0347079 0.0347132 0.0355770 0.0336886 0.0342410 0.0342657 0.0351127 0.0331410 0.0311382 0.0301916 0.0280698 0.0275990 0.0265259 0.0270567 0.0238930 0.0227895 0.0242169 0.0228013 0.0228350 0.0221353 0.0227990 0.0222092 0.0217445 0.0213568 0.0213011 0.0231517
Switzerland † ¶ 92 NA 0.0542069 0.0538756 0.0556785 0.0511686 0.0477386 0.0413746 0.0402679 0.0409977 0.0381821 0.0364141 0.0356291 0.0321097 0.0315166 0.0308529 0.0275555 0.0274024 0.0264802 0.0259201 0.0248664 0.0245604 0.0243138 0.0232416 0.0220256 0.0222505 0.0213647 0.0220566 0.0199098 0.0202470 0.0206999 0.0206664 0.0203435 0.0223601
UK 93 NA 0.1017579 0.0994989 0.0942881 0.0950801 0.0846662 0.0787025 0.0748076 0.0684056 0.0689436 0.0663903 0.0656777 0.0646031 0.0632885 0.0627517 0.0629144 0.0624233 0.0595588 0.0572445 0.0561682 0.0563338 0.0558122 0.0548669 0.0532500 0.0529363 0.0505120 0.0498245 0.0480710 0.0468756 0.0466020 0.0459977 0.0461424 0.0454431
Middle East NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Bahrain 94 NA NA NA 0.1428571 0.1698113 0.1674641 0.1677316 0.1628615 0.1709145 0.1929825 0.1361080 0.1758865 0.1701863 0.1715375 0.1464435 0.1452174 0.1591468 0.1552795 0.1290107 0.1286651 0.1266247 0.1184164 0.1408412 0.1148188 0.1294039 0.1204607 0.1206429 0.1555088 0.1267118 0.1330078 0.1334646 0.1200669 0.1208143
Egypt July-June NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1060178 0.1037041 0.0955410 0.0895488 0.0754541 0.0761219 0.0667141 0.0624927 0.0622802 0.0601347 0.0534491 0.0465059 0.0473653 0.0522730 0.0509134 0.0441765 0.0415171 0.0420115
Iran 95 April-March NA NA 0.1447851 0.1248762 0.0989693 0.0513950 0.0759890 0.0849850 0.1064925 0.1186799 0.1294324 0.1256841 0.1403699 0.1447869 0.1086260 0.1209906 0.1518302 0.1414528 0.1420854 0.1402302 0.1260657 0.1532192 0.1515561 0.1300990 0.1932366 0.1561127 0.1480314 0.1543386 0.1520682 0.1604844 0.1346766 0.1333710
Iraq ¶ 96 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0183223 0.0354809 0.0377034 0.0485648 0.0413552 0.0491946 0.0546512 0.0531124 0.0442878 0.0687233 0.0673921 0.1245384 0.0837915 0.1096852 0.0884058 0.0776852
Israel 97 NA NA NA NA NA NA NA NA NA NA NA NA NA 0.1332878 0.1318023 0.1280710 0.1383711 0.1436344 0.1434123 0.1409473 0.1538014 0.1520070 0.1460968 0.1469073 0.1457715 0.1405241 0.1382624 0.1476194 0.1458800 0.1447315 0.1426354 0.1352820 0.1324502
Jordan NA NA 0.2103250 0.2119461 0.1751227 0.2208084 0.1918649 0.1887187 0.1870079 0.1233118 0.1632653 0.1773649 0.1745166 0.1863450 0.1831625 0.1778937 0.1592083 0.1606667 0.1362594 0.1233429 0.1281298 0.1604911 0.1765244 0.1850590 0.1792997 0.1515391 0.1263991 0.1248054 0.1181457 0.1280259 0.1560815 0.1623291 0.1500432 0.1518737
Kuwait 98 April-March NA NA 0.5256202 0.5747810 0.3499622 0.2026814 0.2265571 0.2488146 0.2311815 0.1851529 0.1691391 0.1689731 0.1955871 0.1792918 0.1767312 0.1766711 0.1697129 0.1544461 0.1110048 0.1193622 0.0744142 0.0941435 0.0839527 0.0896471 0.0879515 0.0857638 0.0809731 0.0920435 0.1096314 0.1091285 0.1044512 0.1054330
Lebanon NA NA NA NA 0.1914429 0.1468078 0.2240358 0.2644851 0.1499044 0.2187238 0.1316650 0.1076626 0.1172774 0.1358413 0.1275487 0.1418420 0.1309742 0.1300989 0.1354790 0.1424898 0.1267943 0.1318711 0.1170065 0.1255633 0.1414677 0.1413489 0.1320633 0.1428022 0.1636963 0.1682428 0.1801740 0.1505781 0.1563959 0.1378350
Oman ‡ 99 NA NA NA 0.2961303 0.2577324 0.2647980 0.2509746 0.2582744 0.2501397 0.2450554 0.2543973 0.2273890 0.2199744 0.2269648 0.2463041 0.2372606 0.2344998 0.2306885 0.2518895 0.2362195 0.2186383 0.1938729 0.1819562 0.1846984 0.1870586 0.2739640 0.2480608 0.2139199 0.2148691 0.2367609 0.2105131 0.2102396 0.2033878
Qatar NA NA NA NA 0.2525222 0.2790465 NA NA NA NA NA NA NA NA NA NA 0.1246344 0.1160551 0.0842241 0.0685852 0.0615254 0.0697953 0.0873885 0.0606366 0.0489987 NA NA NA NA NA NA NA NA NA
Saudi Arabia 100 NA NA NA 0.3544359 0.3544359 0.2725513 0.3283411 0.3130129 0.2844885 0.2525023 0.3072261 0.4116121 0.3736925 0.3179415 0.3091296 0.2720863 0.2623246 0.2599072 0.2746146 0.2878124 0.2895147 0.2756197 0.2594634 0.2594749 0.2201415 0.2309937 0.2526555 0.2655253 0.3265251 0.2552313 0.3069767 0.2586327 0.2033935
Syria NA NA NA NA 0.2429952 0.3042676 0.2631799 0.2461392 0.2433594 0.2335468 0.2181703 0.2030433 0.2014886 0.2073189 0.1901951 0.1888016 0.1737983 0.1914298 0.1768916 0.1783930 0.1647992 0.1592923 0.1546817 0.1505224 0.1362182 NA NA NA NA NA NA NA NA NA
Turkey NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0922962 0.0812188 0.0918505 0.0850170 0.0772870 0.0743047 0.0687709 0.0657748 0.0638116 0.0652311 0.0633419 0.0612115 0.0588401 0.0566943 0.0566160 0.0546108 0.0588468 0.0614346 0.0735888 0.0780862
UAE 101 NA NA NA NA NA NA NA NA NA NA 0.1915982 0.2060725 0.2065200 0.2618588 0.2224509 0.2285465 0.2340298 0.2604259 0.2322490 0.2064326 0.1858166 0.1671084 0.1559310 0.1874156 0.1754851 0.1742759 0.1991489 0.1703877 NA NA NA NA NA
Yemen 102 NA NA NA 0.2459528 0.2833639 0.2954541 0.2741912 0.3335221 0.2632118 0.1720435 0.1696392 0.1774598 0.1831159 0.1551154 0.1797692 0.2240081 0.1940885 0.1551827 0.1324022 0.1152961 0.1202177 0.1077856 0.1605471 0.1551329 0.1650961 0.1262876 0.1324638 0.1427962 NA NA NA NA NA
Yemen, North 103 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA

Factor Variables

What is a factor variable?

In general, factors are used for:

  1. categorical variables with a fixed and known set of possible values.
  • e.g., month_born = January, February, March, …, December
  1. displaying character vectors in non-alphabetical order.
  • e.g., day_born = Sunday, Monday, Tuesday, …, Saturday

California Counties

Let’s consider the counties included in the ca_tax_rev data. I have randomly selected 25 counties for us to consider.

entity_name
Marin County
Kern County
Colusa County
Ventura County
Plumas County
Del Norte County
Lake County
Nevada County
Tehama County
Humboldt County
Santa Barbara County
Glenn County
Alameda County
Amador County
Kings County
Tulare County
Trinity County
San Luis Obispo County
Riverside County
San Bernardino County
Santa Cruz County
San Diego County
Tuolumne County
Los Angeles County
El Dorado County

forcats

We use this package to…

  • turn character variables into factors

  • rename or reorder the levels of an existing factor

  • collapse levels of an existing factor

The image shows a hexagonal logo with a brown border featuring a group of black cats resting inside a cardboard box. The cats appear relaxed, laying on top of one another, with their eyes closed or half-open. The word forcats is written on the side of the box in a light brown color. This image represents the logo of the R package forcats, which is typically used for handling categorical variables (factors) in data analysis within the R programming environment.

forcats loads with tidyverse!

The packages forcats (“for categoricals”) helps wrangle categorical variables.

Creating a Factor – fct()

ca_tax_rev <- ca_tax_rev |> 
  mutate(entity_name = fct(entity_name))

To change a column type to factor, you must wrap fct() in a mutate() call.


With fct(), the levels are automatically ordered in the order of first appearance.

Creating a Factor – fct()

You can specify the order of the levels with level.

ca_tax_rev <- ca_tax_rev |> 
  mutate(entity_name = fct(entity_name, 
                           levels = c("Los Angeles County", 
                                      "San Diego County", 
                                      "Orange County", 
                                      "Riverside County", 
                                      "San Bernardino County",
                                      "Santa Clara County", 
                                      "Alameda County", 
                                      "Sacramento County", 
                                      "Contra Costa County", 
                                      "Fresno County", 
                                      "Kern County", 
                                      "Ventura County", 
                                      "San Joaquin County", 
                                      "San Mateo County", 
                                       ...
                                       )
                           )
         )

But that is sometimes a bit tedious.

fct_reorder()

Often times, we want to reorder a factor based on the values of another variable. For example, we might want to reorder the CA counties based on their mean sales taxes.

ca_tax_rev <- ca_tax_rev |> 
  mutate(entity_name = fct_reorder(.f = entity_name,
                                   .x = sales_and_use_taxes,
                                   .fun = mean)
         )

.f: the factor variable you want to reorder

.x: the variable you want to the reordering to be based on

.fun: the function you want to use when doing the reordering

fct_reoder() with ggplot()

The vast majority of the time we want to reorder a factor because we want our visualization to look nicer.

fct_reorder() with ggplot()

So, we could instead do this process inside ggplot().

ca_tax_rev |> 
  filter(sales_and_use_taxes < quantile(sales_and_use_taxes, probs = 0.1))|> 
  ggplot(aes(x = sales_and_use_taxes, 
             y = fct_reorder(.f = entity_name,
                             .x = sales_and_use_taxes,
                             .fun = mean), 
             fill = entity_name)
         ) +
  geom_density_ridges(alpha = 0.5) +
  theme_minimal() +
  theme(legend.position = "none") +
  labs(x = "Sales and Use Taxes",
       y = "") +
  scale_x_continuous(labels = scales::label_dollar())

fct_reorder2()

There might be times were we want to use two variables to reorder the levels of a factor.

Code
ca_tax_rev |> 
  filter(sales_and_use_taxes < quantile(sales_and_use_taxes, probs = 0.1)) |> 
  ggplot(aes(x = sales_and_use_taxes, 
             y = total_property_taxes,
             color = fct_reorder2(.f = entity_name,
                                  .x = sales_and_use_taxes,
                                  .y = total_property_taxes)
             )
         ) +
  geom_point(size = 1.5) +
  theme_bw() +
  scale_y_continuous(labels = scales::label_dollar()) +
  scale_x_continuous(labels = scales::label_dollar()) +
  labs(y = "Total Property Taxes",
       x = "Sales and Use Taxes",
       color = "California County")

Collapsing a Factor –fct_collapse()

Suppose we want to make a new variable that classifies the county based on its population: low, medium, and high. Here, we want to collapse existing levels of a factor.

high_pop <- c(
  "Los Angeles County", "San Diego County", "Orange County", "Riverside County", 
  "San Bernardino County", "Santa Clara County", "Alameda County", 
  "Sacramento County", "Contra Costa County", "Fresno County", "Kern County", 
  "Ventura County", "San Joaquin County", "San Mateo County", 
  "Stanislaus County", "Sonoma County", "Tulare County"
)

medium_pop <- c(
  "Solano County", "Santa Barbara County", "Monterey County", "Placer County", 
  "Merced County", "San Luis Obispo County", "Santa Cruz County", "Marin County", 
  "Yolo County", "Butte County", "El Dorado County", "Imperial County", 
  "Shasta County", "Madera County", "Kings County", "Napa County", 
  "Humboldt County", "Nevada County", "Sutter County", "Mendocino County", 
  "Yuba County", "San Benito County", "Lake County", "Tehama County", 
  "Tuolumne County", "Calaveras County", "Siskiyou County", "Amador County", 
  "Lassen County", "Glenn County", "Del Norte County", "Colusa County"
)

low_pop <- c(
  "Plumas County", "Inyo County", "Mariposa County", "Trinity County", 
  "Mono County", "Modoc County", "Sierra County", "Alpine County"
)

Collapsing a Factor –fct_collapse()

ca_tax_rev <- ca_tax_rev |> 
  mutate(pop_class = fct_collapse(.f = entity_name,
                                  high = high_pop,
                                  medium = medium_pop, 
                                  low = low_pop)
         ) 


Important

The syntax here is:

<new level> = c("<old level>",
                "<old level>",
                ...)
entity_name pop_class
Monterey County medium
Riverside County high
Placer County medium
Napa County medium
Modoc County low
Fresno County high

Lab 4: Childcare Costs in California

The image is a color-coded map of the United States, showing the cost of childcare across different states. The map uses a gradient scale from light green (representing lower costs around $5,000) to dark blue (representing higher costs around $21,000). States with the most expensive childcare, such as Massachusetts ($21,019) and Washington, D.C. ($20,913), are shaded in dark blue, indicating the highest costs. States with lower costs, such as Mississippi ($5,436) and Alabama ($6,001), are shaded in light green. The map's data comes from the Economic Policy Institute, with the source indicated as Money Scoop, and was created using Datawrapper.

To do…

  • Lab 4: Childcare Costs in California
    • Due Monday (10/13) at 5pm
  • Week 5: Strings + Dates
    • Check-in 5.1 (Strings) due Tuesday (10/14) at 8am
    • Check-in 5.2 (Dates) due Thursday (10/14) at 8am