Skip to content

Instantly share code, notes, and snippets.

@sicarul
Created April 28, 2019 03:55
Show Gist options
  • Save sicarul/a5436da2ab8cd5cf58d3636303640455 to your computer and use it in GitHub Desktop.
Save sicarul/a5436da2ab8cd5cf58d3636303640455 to your computer and use it in GitHub Desktop.
Pbi Vs Libertad
library(tidyverse)
library(countrycode)
library(gganimate)
library(ggrepel)
gapminder <- read_csv("https://raw.githubusercontent.com/cienciadedatos/datos-de-miercoles/master/datos/2019/2019-04-24/gapminder_es.csv")
# freedom = read_csv('freedom.csv') # - Obtenido de https://www.fraserinstitute.org/economic-freedom/dataset?geozone=world&page=dataset&min-year=2&max-year=0&filter=0
# datapasta::tribble_paste(spread(freedom, anio, libertad_economica))
freedom = tibble::tribble(
~pais, ~X1950, ~X1955, ~X1960, ~X1965, ~X1970, ~X1975, ~X1980, ~X1985, ~X1990, ~X1995, ~X2000, ~X2001, ~X2002, ~X2003, ~X2004, ~X2005, ~X2006, ~X2007, ~X2008, ~X2009, ~X2010, ~X2011, ~X2012, ~X2013, ~X2014, ~X2015, ~X2016,
"Albania", NA, NA, NA, NA, NA, NA, NA, NA, 4.58, 5.01, 6.53, 6.6, 6.85, 7.37, 6.97, 6.96, 7.14, 7.21, 7.22, 7.31, 7.35, 7.24, 7.2, 7.27, 7.48, 7.53, 7.54,
"Algeria", NA, NA, NA, 3.64, NA, NA, 3.79, 3.59, 3.33, 3.94, 4.91, 4.99, 4.94, 4.95, 5.04, 5.63, 5.68, 5.36, 5.16, 5.18, 5.07, 5.06, 4.95, 5.04, 5.01, 4.83, 4.99,
"Angola", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3.81, 4.44, 4.57, 4.41, 5.14, 5.3, 5.16, 5.28, 5.25, 5.13, 5.44, 5.17,
"Argentina", 4.82, 4.91, 5.32, 5.16, 5.67, 3.13, 4.25, 3.53, 4.47, 6.95, 7.34, 6.84, 6.28, 6.16, 6.33, 5.99, 6.08, 6.19, 5.88, 5.82, 5.59, 5.58, 5.04, 4.88, 4.49, 4.98, 4.84,
"Armenia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.36, 7.31, 7.45, 7.42, 7.59, 7.55, 7.56, 7.71, 7.75, 7.69, 7.7, 7.59, 7.57,
"Australia", 6.23, 5.95, 6.38, 6.97, 6.93, 6.06, 6.85, 7.16, 7.73, 7.95, 8.19, 8.07, 8.05, 8.06, 8.01, 8.07, 8.14, 8.18, 8.08, 7.97, 8.02, 8.01, 7.96, 7.92, 8.02, 8, 7.98,
"Austria", 5.72, 5.63, 6.67, 6.69, 6.51, 6.04, 6.45, 6.46, 6.95, 7.15, 7.96, 7.84, 7.8, 7.94, 7.9, 7.85, 7.85, 7.81, 7.7, 7.66, 7.62, 7.65, 7.62, 7.63, 7.68, 7.64, 7.58,
"Azerbaijan", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.19, 6.01, 6.1, 6.11, 6.15, 6.06, 5.97, 6.15, 6.32, 6.2, 6.4, 6.38, 6.49,
"Bahamas", NA, NA, NA, NA, NA, 6.43, 6.28, 6.32, 6.44, 6.41, 6.66, 6.75, 6.72, 7.07, 7.18, 7.38, 7.46, 7.55, 7.58, 7.49, 7.38, 7.32, 7.31, 7.33, 7.32, 7.35, 7.34,
"Bahrain", NA, NA, NA, NA, NA, NA, 7.39, 6.6, 6.62, 6.91, 7.42, 7.33, 7.33, 7.2, 7.02, 6.89, 7.35, 7.52, 7.42, 7.29, 7.47, 7.49, 7.33, 7.33, 7.36, 7.37, 7.56,
"Bangladesh", NA, NA, NA, NA, NA, 3.29, 3.28, 3.59, 4.45, 5.3, 5.91, 5.81, 5.89, 5.82, 5.72, 6.02, 6.18, 6.06, 6.07, 6.3, 6.35, 6.34, 6.24, 6.37, 6.3, 6.33, 6.3,
"Barbados", NA, NA, NA, NA, NA, 5.67, 5.72, 6.06, 5.99, 6.01, 6.13, 6.15, 6.05, 5.83, 6.13, 6.31, 6.1, 6.12, 6.22, 6.56, 6.63, 6.63, 6.67, 6.68, 6.63, 6.5, 6.43,
"Belarus", 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, 6.23,
"Belgium", 5.91, 6.12, 6.95, 6.86, 7.44, 6.75, 7.35, 7.32, 7.56, 7.32, 7.76, 7.41, 7.52, 7.55, 7.47, 7.41, 7.39, 7.38, 7.3, 7.28, 7.39, 7.38, 7.35, 7.37, 7.59, 7.43, 7.32,
"Belize", NA, NA, NA, NA, NA, NA, 5.59, 5.4, 5.9, 6.63, 6.39, 6.28, 6.49, 6.56, 7.02, 7.37, 7.27, 7.34, 7.32, 7.07, 6.52, 7.12, 7.13, 7.03, 6.9, 6.81, 6.86,
"Benin", NA, NA, 3.79, 3.74, NA, NA, 4.56, 4.26, 4.54, 4.2, 5.25, 5.57, 6.04, 6.03, 5.91, 6, 6.28, 6.14, 5.99, 6.1, 6.05, 6, 5.74, 6.44, 5.94, 5.78, 5.98,
"Bhutan", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.93, 6.99, 7.11, 7.02,
"Bolivia", 4.73, 4.72, 5.59, 6.02, NA, NA, 4.08, 3.52, 5.62, 6.84, 6.97, 6.88, 6.57, 6.47, 6.45, 6.34, 6.37, 6.14, 6.09, 6.3, 6.35, 6.31, 6.38, 6.4, 6.21, 6.05, 6.23,
"Bosnia and Herzegovina", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.18, 6.48, 6.61, 6.56, 6.56, 6.63, 6.7, 6.79, 6.61, 6.78, 6.63, 6.6,
"Botswana", NA, NA, NA, NA, NA, NA, 5.34, 5.66, 5.92, 6.4, 7.44, 7.2, 7.22, 7.05, 7.1, 7.09, 6.99, 7.12, 6.85, 6.76, 7.02, 7.22, 7.25, 7.27, 7.24, 7.35, 7.43,
"Brazil", 5.13, 4.96, 5.43, 5.19, 5.28, 4.19, 3.92, 2.96, 4.23, 4.66, 5.98, 5.98, 6.23, 6.08, 6.15, 6.18, 6.15, 6.17, 6.31, 6.24, 6.46, 6.45, 6.24, 6.05, 5.93, 5.75, 5.75,
"Brunei Darussalam", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.07, 6.92, 7.07, 6.75, 6.89, 6.77, 6.93,
"Bulgaria", NA, NA, NA, NA, NA, NA, NA, 5.65, 4.17, 4.82, 5.55, 6.11, 6.58, 6.81, 6.81, 6.95, 7.08, 7.1, 7.17, 7.29, 7.3, 7.37, 7.37, 7.33, 7.37, 7.4, 7.41,
"Burkina Faso", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.85, 5.84, 5.99, 5.95, 5.9, 5.93, 5.95, 5.81, 5.96, 6.02, 6.03, 6.05,
"Burundi", NA, NA, NA, 4.51, NA, 3.97, 3.92, 4.44, 4.66, 4.3, 4.8, 5.07, 5.01, 4.82, 4.88, 5.06, 5.53, 5.46, 5.01, 5.43, 5.18, 5.23, 5.22, 5.96, 5.97, 5.87, 5.92,
"Cambodia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.08, 6.98, 6.92, 7.17, 7.16, 7.2, 7.17,
"Cameroon", NA, NA, 4.18, 5.71, NA, NA, 5.55, 5.43, 5.5, 5.33, 5.61, 5.78, 5.68, 5.75, 5.79, 5.65, 5.8, 5.68, 5.57, 5.85, 6.08, 6.03, 6.05, 5.95, 5.9, 5.79, 5.82,
"Canada", 6.48, 7.09, 7.21, 7.14, 8, 7.2, 7.77, 7.87, 8.17, 8.08, 8.27, 8.2, 8.06, 8.16, 8.17, 8.12, 8.13, 8.09, 8.04, 8.01, 8.01, 7.95, 7.99, 8.03, 8.22, 7.91, 7.98,
"Cape Verde", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.38, 6.53, 6.56, 6.62, 6.56, 6.67, 6.68,
"Central Afr. Rep.", NA, NA, 3.57, 3.41, NA, NA, 4.29, 4.39, 4.87, 4.63, 5.09, 5.2, 4.95, 5.43, 5.29, 4.74, 4.93, 5.19, 5.18, 5.2, 5.04, 5.06, 4.93, 5.71, 5.16, 4.63, 5.11,
"Chad", NA, NA, 3.63, 3.6, NA, NA, NA, 4.45, 5.13, 5.09, 5.43, 5.42, 5.67, 5.58, 5.43, 5.17, 5.17, 4.97, 4.84, 5.16, 5.44, 4.97, 4.72, 4.99, 4.97, 5.23, 5.44,
"Chile", 4.78, 4.86, 5.55, 5.57, 3.58, 3.34, 5.05, 5.55, 6.61, 7.37, 7.36, 7.37, 7.6, 7.76, 7.71, 7.74, 7.76, 7.87, 7.8, 7.87, 7.89, 7.91, 7.81, 7.88, 7.84, 7.79, 7.8,
"China", NA, 4.19, 3.94, 4.13, NA, NA, 3.64, 4.82, 4.09, 5.07, 5.75, 5.84, 6.09, 6.15, 5.98, 6.07, 6.16, 6.28, 6.27, 6.31, 6.26, 6.32, 6.37, 6.39, 6.38, 6.39, 6.46,
"Colombia", 5.26, 4.88, 6.12, 6.06, 4.81, 4.62, 4.59, 5.06, 5.02, 5.48, 5.67, 6.23, 6.27, 6.4, 6.35, 6.34, 6.51, 6.66, 6.6, 6.7, 6.74, 6.82, 6.72, 6.67, 6.58, 6.55, 6.5,
"Congo, Dem. R.", NA, NA, NA, 4.52, 4.26, 3.92, 2.84, 3.53, 3.12, 3.41, 4.01, 3.93, 4.84, 4.94, 4.64, 4.61, 5.08, 5.18, 5.16, 5.28, 5.38, 5.28, 5.2, 5.36, 5.23, 5.78, 5.67,
"Congo, Rep. Of", NA, NA, 4.18, 3.82, NA, NA, 4.67, 4.3, 4.77, 4.96, 4.26, 4.66, 4.5, 4.72, 4.55, 4.54, 4.63, 4.53, 4.69, 4.9, 4.74, 4.48, 4.39, 4.55, 4.69, 4.81, 5.02,
"Costa Rica", 5.8, 6.75, 6.74, 6.31, NA, 6.7, 5.52, 5.33, 6.98, 7.33, 7.46, 7.32, 7.18, 7.4, 7.22, 7.56, 7.76, 7.59, 7.37, 7.37, 7.28, 7.57, 7.53, 7.48, 7.5, 7.51, 7.55,
"Cote d'Ivoire", NA, NA, 4.16, 4.73, NA, NA, 5.2, 5.34, 4.91, 5, 5.78, 5.68, 5.6, 5.71, 5.75, 5.87, 5.5, 5.44, 5.5, 5.69, 5.69, 5.7, 5.64, 5.9, 6, 5.93, 6,
"Croatia", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.08, 6.28, 6, 6.24, 6.3, 6.34, 6.47, 6.54, 6.61, 6.72, 6.78, 6.68, 6.9, 6.93, 6.9, 7, 7.04, 6.96,
"Cyprus", NA, 6.47, 6.03, 5.55, NA, 6.04, 5.56, 5.52, 5.87, 6.34, 6.64, 6.65, 7.12, 7.01, 7.65, 7.56, 7.5, 7.77, 7.74, 7.77, 7.73, 7.67, 7.47, 7.07, 7.33, 7.69, 7.71,
"Czech Rep.", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.76, 6.74, 6.82, 6.87, 6.82, 6.94, 6.98, 7.03, 7.17, 7.21, 7.17, 7.22, 7.26, 7.42, 7.37, 7.46, 7.49, 7.56,
"Denmark", 5.8, 5.65, 6.54, 6.3, 7.39, 6.09, 6.24, 6.37, 7.16, 7.73, 8.06, 7.88, 7.88, 8.01, 8, 7.89, 7.97, 7.97, 7.88, 7.66, 7.77, 7.71, 7.56, 7.68, 7.81, 7.75, 7.77,
"Dominican Rep.", 4.62, 5.32, 5.21, 4.86, NA, NA, 5.59, 5.33, 4.42, 6.12, 6.82, 6.97, 6.76, 6.31, 5.79, 6.52, 6.43, 6.5, 6.46, 6.95, 7.16, 7.18, 7.03, 7.24, 7.26, 7.24, 7.18,
"Ecuador", 5.61, 5.76, 5.86, 5.85, 4.22, 5.31, 5.7, 4.6, 5.47, 6.31, 5.86, 5.76, 6.25, 6.25, 5.68, 5.94, 5.99, 5.83, 6.02, 5.92, 5.87, 5.88, 6.03, 5.88, 5.66, 6.09, 6.06,
"Egypt", 5.4, 4.54, 4.38, 4.23, NA, 3.75, 4.32, 4.72, 4.41, 5.79, 6.51, 6.3, 5.99, 5.87, 5.98, 6.29, 6.4, 6.59, 6.43, 6.21, 6.35, 6.18, 6.14, 6.01, 5.78, 5.77, 5.72,
"El Salvador", 6.16, 5.98, 6.11, 5.15, NA, NA, 4.12, 4.34, 4.81, 7.64, 7.72, 7.59, 7.52, 7.55, 7.64, 7.47, 7.57, 7.63, 7.53, 7.4, 7.21, 7.14, 7.09, 7.2, 7.35, 7.14, 7.15,
"Estonia", NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.23, 7.6, 7.67, 7.72, 7.84, 7.98, 7.96, 7.97, 7.85, 7.77, 7.7, 7.82, 7.74, 7.68, 7.7, 7.79, 7.93, 7.86,
"Ethiopia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.54, 5.68, 5.74, 5.35, 5.78, 5.6, 5.16, 5.58, 5.53, 5.46, 5.55, 5.73,
"Fiji", NA, NA, NA, NA, NA, 5.27, 5.57, 5.97, 5.72, 6.11, 6.65, 6.51, 6.57, 6.53, 6.73, 7.32, 7.13, 7.2, 7.26, 7.08, 6.93, 7.04, 6.84, 6.44, 6.63, 6.82, 6.79,
"Finland", 5.8, 5.68, 6.29, 6.59, 7.12, 6.05, 6.5, 6.77, 6.99, 7.52, 7.98, 7.9, 7.9, 7.9, 7.87, 7.86, 7.88, 7.91, 7.81, 7.71, 7.79, 7.87, 7.81, 7.7, 7.79, 7.71, 7.65,
"France", 5.88, 5.46, 5.41, 5.48, 6.51, 5.81, 6.05, 6.03, 7.04, 6.97, 7.47, 7.23, 7.32, 7.33, 7.38, 7.31, 7.32, 7.5, 7.42, 7.43, 7.42, 7.33, 7.27, 7.23, 7.36, 7.35, 7.25,
"Gabon", NA, NA, 4.07, 4.87, NA, NA, 4.38, 5.28, 5.39, 5.3, 5.71, 5.56, 5.4, 5.47, 5.69, 5.71, 5.89, 5.81, 5.85, 5.8, 5.54, 5.44, 5.37, 5.42, 5.57, 5.78, 5.84,
"Gambia, The", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.24, 7.04, 6.87, 7.32, 7.35, 7.22, 7.34,
"Georgia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.11, 6.96, 7.42, 7.6, 7.46, 7.57, 7.41, 7.5, 7.64, 7.75, 7.87, 8.02, 7.98, 8.02,
"Germany", 5.73, 5.44, 6.65, 6.7, 7.4, 6.76, 7.18, 7.27, 7.64, 7.62, 7.8, 7.65, 7.67, 7.76, 7.7, 7.75, 7.7, 7.58, 7.5, 7.55, 7.59, 7.68, 7.64, 7.66, 7.67, 7.67, 7.69,
"Ghana", NA, 4.43, 4.79, 4.08, NA, 3.6, 2.83, 3.16, 4.95, 5.43, 5.82, 5.88, 6.29, 6.5, 6.55, 6.42, 6.92, 6.88, 6.82, 6.87, 6.75, 6.76, 6.44, 6.55, 6.41, 6.52, 6.6,
"Greece", 5.48, 5.57, 5.92, 5.72, 6.47, 5.82, 5.72, 5.1, 5.95, 6.4, 6.97, 6.88, 7.01, 7.34, 7.26, 7.38, 7.27, 7.32, 7.1, 6.96, 6.81, 6.69, 6.67, 6.88, 6.81, 6.45, 6.46,
"Guatemala", 5.95, 5.93, 6.13, 5.27, 6.69, 7.24, 6.27, 5.01, 5.81, 7.15, 6.85, 6.89, 6.95, 7.05, 7.22, 7.22, 7.33, 7.34, 7.21, 7.15, 7.15, 7.22, 7.41, 7.66, 7.65, 7.69, 7.64,
"Guinea", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.65, 5.62, 5.74, 5.93,
"Guinea-Bissau", NA, NA, NA, NA, NA, NA, NA, NA, 2.9, 3.12, 4.3, 4.87, 4.93, 4.94, 4.84, 4.8, 5.05, 4.78, 4.81, 5.19, 5.05, 5.62, 5.96, 5.07, 5.35, 5.58, 5.25,
"Guyana", NA, 4.16, 4.39, 4.47, NA, NA, NA, 3.27, NA, 5, 6.45, 6.27, 6.34, 6.23, 5.76, 5.85, 6, 6.2, 6.4, 6.33, 6.21, 6.31, 6.3, 6.04, 6.21, 6.52, 6.31,
"Haiti", NA, 5, 5.13, 5.14, NA, NA, 5.35, 4.97, 4.96, 5.43, 7.06, 6.47, 6.55, 6.68, 6.73, 6.66, 6.71, 6.63, 6.76, 6.79, 6.21, 6.29, 6, 6.36, 6.58, 6.54, 6.51,
"Honduras", 6.58, 6.23, 6.2, 5.89, NA, NA, 5.44, 5.73, 5.7, 6.52, 6.9, 6.75, 6.87, 6.92, 6.96, 7.03, 7.35, 7.39, 7.28, 7.16, 7.21, 7.28, 7.16, 7.13, 7.26, 7.35, 7.06,
"Hong Kong", NA, NA, NA, NA, 8.34, 8.42, 8.72, 8.34, 8.73, 9.11, 8.92, 8.89, 8.8, 8.85, 8.81, 9.05, 9.11, 9.16, 9.19, 9.09, 9.02, 8.99, 8.96, 8.96, 9, 8.97, 8.97,
"Hungary", NA, NA, NA, NA, NA, NA, 4.07, 4.48, 4.89, 6.17, 7.01, 7.39, 7, 7.09, 7.22, 7.2, 7.13, 7.15, 7.2, 7.27, 7.31, 7.38, 7.33, 7.34, 7.36, 7.19, 7.22,
"Iceland", NA, 6.36, 6.69, 6.6, 5.95, 4.53, 5.15, 5.42, 6.92, 7.73, 7.99, 7.91, 7.8, 8.03, 8.06, 8.13, 8.08, 7.93, 7.34, 6.9, 6.48, 6.86, 6.94, 7.02, 7.23, 7.25, 7.22,
"India", 5.9, 5.29, 5.71, 5.42, 5.08, 4.27, 5.02, 4.72, 4.79, 5.76, 6.22, 6.1, 6.27, 6.37, 6.34, 6.71, 6.52, 6.52, 6.47, 6.39, 6.39, 6.57, 6.54, 6.36, 6.23, 6.61, 6.63,
"Indonesia", NA, NA, 4.67, 4.92, 4.27, 4.78, 4.79, 5.79, 6, 6.3, 5.86, 5.56, 5.8, 6.12, 6.04, 6.35, 6.4, 6.42, 6.39, 6.55, 6.85, 6.87, 6.84, 7.01, 7.02, 7, 7.16,
"Iran", 5.11, 4.93, 4.84, 5.04, 5.77, 5.64, 3.53, 3.73, 4.29, 4.04, 5.57, 5.93, 5.78, 5.89, 6.01, 6.09, 6.04, 6.02, 6.06, 5.91, 5.91, 5.63, 4.96, 5.04, 4.89, 5.4, 6.03,
"Iraq", 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, 5.4,
"Ireland", 5.95, 5.62, 5.68, 5.78, 6.75, 5.96, 6.46, 6.53, 7.06, 8.25, 8.08, 7.96, 7.85, 8.03, 8.13, 8.22, 8.11, 8.01, 7.87, 7.76, 7.67, 7.83, 7.98, 8.04, 8.12, 8.25, 8.07,
"Israel", 5.18, 4.88, 5.43, 5.4, 4.79, 4.03, 3.5, 4.04, 4.48, 5.91, 6.84, 6.87, 7.23, 7.25, 7.23, 7.3, 7.23, 7.22, 7.2, 7.14, 7.32, 7.35, 7.36, 7.42, 7.45, 7.47, 7.49,
"Italy", 6.39, 5.61, 6.1, 6.26, 6.37, 5.37, 5.58, 5.78, 6.75, 6.62, 7.59, 7.47, 7.5, 7.19, 7.29, 7.37, 7.25, 7.15, 7.07, 6.97, 7.19, 7.22, 7.22, 7.19, 7.25, 7.31, 7.27,
"Jamaica", NA, 6.16, 6.08, 7.28, NA, NA, 3.98, 5.09, 5.62, 6.8, 7.53, 7.4, 7.36, 7.46, 7.55, 7.51, 7.5, 7.32, 7.27, 7.26, 6.97, 7, 7.14, 7.3, 7.13, 7.25, 7.18,
"Japan", NA, 5.65, 5.88, 6.14, 7.68, 6.83, 7.37, 7.55, 7.94, 7.4, 7.93, 7.65, 7.51, 7.85, 7.77, 7.83, 7.85, 7.78, 7.65, 7.52, 7.59, 7.49, 7.66, 7.54, 7.52, 7.46, 7.47,
"Jordan", NA, 3.48, 3.45, 4.35, NA, 4.83, 5.13, 5.5, 5.43, 6.14, 7.06, 6.89, 7, 6.99, 6.92, 7.3, 7.22, 7.4, 7.17, 7.23, 7.45, 7.48, 7.56, 7.65, 7.54, 7.47, 7.46,
"Kazakhstan", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.88, 6.98, 7.15, 7.04, 7.07, 6.94, 6.97, 7.14, 7.13, 7.23, 7.26, 7.11,
"Kenya", NA, NA, 6.25, 5.65, 5.11, 4.8, 4.84, 5.28, 5.37, 5.85, 7.07, 7.1, 6.85, 6.93, 6.74, 7.15, 7.03, 7.1, 6.77, 6.9, 6.92, 6.94, 7.09, 7.12, 7.1, 7.11, 7.2,
"Korea, South", NA, 4, 4.36, 4.8, 5.84, 5.18, 5.38, 5.49, 6.38, 6.58, 6.92, 7.21, 7.22, 7.35, 7.47, 7.46, 7.67, 7.68, 7.46, 7.35, 7.51, 7.52, 7.45, 7.36, 7.55, 7.55, 7.53,
"Kuwait", NA, NA, NA, NA, NA, NA, 3.69, 5.46, 4.98, 6.41, 6.97, 7.45, 7.48, 7.51, 7.09, 7.08, 7.19, 7.33, 7.03, 7.1, 6.95, 6.93, 6.93, 6.84, 6.77, 6.59, 6.75,
"Kyrgyz Republic", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.54, 6.9, 7.01, 6.82, 6.91, 6.61, 6.62, 6.67, 6.76, 6.96, 6.81, 6.93,
"Laos", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.92, 6.97, 6.91,
"Latvia", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.68, 7.24, 7.53, 7.69, 7.54, 7.61, 7.62, 7.76, 7.59, 7.52, 7.33, 7.23, 7.34, 7.56, 7.68, 7.81, 7.72, 7.64,
"Lebanon", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.21, 7.18, 6.96, 6.97, 6.98, 7.01, 6.99,
"Lesotho", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.74, 5.98, 5.84, 6.07, 6.03, 6.08, 6.21, 6.19, 6.32, 6.47, 6.49, 6.38,
"Liberia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.18, 6.87, 6.56,
"Libya", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 4.78, 4.81, 4.89, 4.74,
"Lithuania", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.47, 6.92, 6.87, 7.18, 7.2, 7.41, 7.37, 7.46, 7.54, 7.44, 7.55, 7.47, 7.5, 7.52, 7.72, 7.91, 7.86, 7.86,
"Luxembourg", 6.08, 6.25, 7.43, 7.39, 8.01, 8.48, 8.05, 8.39, 8.07, 7.9, 8.18, 8.18, 7.93, 7.97, 7.98, 7.6, 7.6, 7.62, 7.62, 7.51, 7.53, 7.48, 7.46, 7.61, 7.78, 7.64, 7.6,
"Macedonia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.19, 6.07, 6.42, 6.61, 6.72, 6.83, 6.89, 6.93, 7.11, 7.23, 7.19, 7.24, 7.16, 7.13,
"Madagascar", NA, NA, 4.21, 4.89, 5.43, NA, 3.87, 4.21, 4.35, 4.44, 5.87, 6.17, 5.88, 6, 5.73, 5.68, 5.74, 6.16, 6.07, 6.28, 6.41, 6.21, 6.48, 6.6, 6.44, 6.31, 6.19,
"Malawi", NA, NA, NA, 4.06, NA, 5.12, 4.48, 4.89, 5.32, 4.31, 5.05, 5.6, 5.71, 6.12, 5.9, 5.37, 5.56, 5.85, 6.17, 6.22, 6.27, 6.52, 6.18, 5.92, 5.94, 5.76, 5.86,
"Malaysia", 6.35, 5.64, 6.02, 5.72, 6.25, 6.05, 6.61, 6.68, 7.26, 7.36, 6.64, 6.32, 6.34, 6.42, 6.59, 6.84, 6.8, 6.88, 6.61, 6.6, 6.85, 6.86, 6.85, 7.07, 7.1, 7.15, 6.92,
"Mali", NA, NA, 4.12, 3.8, NA, 5.81, 5.79, 4.88, 5.2, 4.84, 5.99, 5.51, 5.5, 5.95, 5.66, 5.82, 6.09, 6.16, 5.89, 6.04, 6.04, 5.92, 5.99, 5.95, 5.81, 5.82, 5.8,
"Malta", NA, NA, 5.45, 5.52, NA, NA, 5.57, 5.34, 5.54, 7, 6.98, 6.98, 6.88, 6.52, 7.22, 7.55, 7.37, 7.74, 7.59, 7.64, 7.59, 7.67, 7.63, 7.66, 7.8, 7.72, 7.73,
"Mauritania", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.3, 5.9, 5.9, 5.98, 6.04, 5.77, 5.78, 5.68, 5.6, 5.68, 5.7, 5.96,
"Mauritius", NA, NA, 5.76, 6.39, NA, 5.21, 4.9, 6.38, 6.12, 7.81, 7.54, 7.45, 7.29, 7.21, 7.05, 7.53, 7.37, 7.89, 7.96, 7.85, 7.98, 8.05, 8.15, 8.12, 8.02, 8.02, 8.01,
"Mexico", 5.74, 5.94, 5.96, 6.21, 6.78, 5.73, 5.19, 4.67, 6.26, 6.46, 6.6, 6.54, 6.73, 6.72, 6.84, 6.83, 6.87, 6.78, 6.66, 6.53, 6.67, 6.68, 6.71, 6.77, 6.85, 6.88, 6.9,
"Moldova", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.73, 6.74, 6.79, 6.91, 6.66, 6.58, 6.7, 6.64, 6.55, 6.65, 6.57, 6.64,
"Mongolia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.81, 7.08, 7.2, 6.89, 6.73, 7.03, 7.06, 7.17, 7.02, 7.17, 7.32, 7.38, 7.4,
"Montenegro", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.3, 6.91, 7.04, 7.19, 7.16, 7.33, 7.14, 7.25, 7.08, 7.17, 6.74, 7.04,
"Morocco", 5.54, 5.39, 6.21, 4.77, 4.74, 4.91, 4.29, 5, 4.98, 5.85, 5.93, 5.78, 5.9, 6.04, 6.03, 6.28, 6.14, 6.21, 6.22, 6.26, 6.41, 6.47, 6.34, 6.37, 6.28, 6.36, 6.37,
"Mozambique", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.88, 5.61, 5.45, 5.49, 5.61, 5.67, 5.47, 5.51, 5.77, 5.93, 5.78, 5.75, 5.63, 5.5,
"Myanmar", 5.56, 5.13, 4.76, 4.15, NA, NA, 3.81, 3.52, 2.66, 3.21, 3.65, 3.72, 3.34, 3.45, 3.79, 3.99, 4.31, 3.73, 3.86, 4.22, 4.06, 4.44, 5, 5.35, 5.36, 5.32, 5.42,
"Namibia", NA, NA, NA, NA, NA, NA, NA, NA, 4.9, 5.64, 6.65, 6.4, 6.62, 6.72, 6.53, 6.65, 6.63, 6.95, 6.83, 6.93, 6.84, 6.61, 6.79, 6.63, 6.75, 6.61, 6.4,
"Nepal", NA, NA, 4.16, 5.64, NA, NA, 5.77, 5.27, 5.37, 5.33, 5.78, 5.8, 5.87, 5.65, 5.59, 6.41, 6.59, 6.18, 6.03, 5.86, 6.2, 6.12, 6.12, 6.36, 6.45, 6.5, 6.53,
"Netherlands", 5.4, 5.6, 6.18, 6.28, 7.01, 6.6, 7.29, 7.34, 7.56, 7.96, 7.96, 7.75, 7.72, 7.72, 7.75, 7.73, 7.66, 7.64, 7.58, 7.44, 7.48, 7.58, 7.54, 7.62, 7.74, 7.73, 7.71,
"New Zealand", 6.08, 5.58, 5.65, 5.64, 6.62, 5.77, 6.44, 6.29, 7.86, 8.84, 8.58, 8.48, 8.46, 8.49, 8.52, 8.44, 8.26, 8.39, 8.4, 8.27, 8.33, 8.39, 8.47, 8.48, 8.48, 8.48, 8.49,
"Nicaragua", 5.39, 5.09, 5.33, 4.61, NA, NA, 3.49, 1.97, 2.87, 6.02, 6.91, 6.63, 6.93, 6.99, 6.87, 7.15, 7.25, 7.29, 7.12, 7.09, 7.18, 7.31, 7.36, 7.34, 7.3, 7.27, 7.27,
"Niger", NA, NA, 4.17, 5.05, NA, 5.56, 4.62, 4.51, 4.66, 4.04, 5.02, 4.72, 4.81, 4.76, 4.86, 5, 5.32, 5.25, 5.39, 5.7, 5.91, 5.8, 5.55, 5.69, 5.79, 5.74, 6.01,
"Nigeria", NA, 5.09, 5.68, 4.91, 4.28, 3.85, 3.44, 4.18, 3.5, 3.81, 5.17, 5.2, 5.53, 5.52, 5.6, 5.95, 6.53, 6.34, 6.03, 5.89, 6.12, 6.34, 6.22, 6.39, 6.38, 6.39, 6.32,
"Norway", 6.39, 5.61, 6.14, 6.06, 6.19, 5.57, 5.72, 6.39, 6.99, 7.57, 7.36, 7.26, 7.14, 7.66, 7.62, 7.73, 7.59, 7.73, 7.63, 7.5, 7.47, 7.56, 7.58, 7.6, 7.62, 7.65, 7.6,
"Oman", NA, NA, NA, NA, NA, NA, NA, 6.63, 6.2, 6.67, 7.47, 7.51, 7.52, 7.57, 7.28, 7.23, 6.96, 7.18, 7.08, 7.13, 7.01, 6.91, 7.04, 6.98, 7.05, 6.64, 6.76,
"Pakistan", 4.68, 4.55, 4.5, 4.81, 4.45, 3.51, 4.25, 4.83, 4.81, 5.55, 5.55, 5.61, 5.85, 5.63, 5.68, 6.09, 6.16, 6.09, 5.97, 6.12, 6.17, 6.23, 6.15, 6.14, 5.89, 5.92, 6,
"Panama", 6.19, 6.35, 6.41, 6.41, NA, 7.32, 6.07, 6.7, 6.82, 7.86, 7.61, 7.55, 7.49, 7.55, 7.54, 7.57, 7.49, 7.56, 7.24, 7.25, 7.22, 7.13, 7.34, 7.38, 7.48, 7.57, 7.58,
"Pap. New Guinea", NA, NA, NA, NA, NA, NA, NA, 6.02, 6.07, 6.06, 6.13, 6.1, 6.06, 6, 6.06, 6.48, 6.39, 6.7, 6.77, 6.83, 6.87, 6.83, 6.91, 6.96, 6.28, 6.17, 6.25,
"Paraguay", 3.28, 4.61, 5.32, 5.4, NA, NA, 6.24, 5.24, 5.94, 7.04, 6.79, 6.72, 6.59, 6.53, 6.45, 6.48, 6.41, 6.37, 6.5, 6.56, 6.74, 6.8, 6.89, 6.95, 6.87, 6.91, 6.95,
"Peru", 5.77, 6.22, 6.44, 6.25, 4.62, 3.5, 3.6, 2.47, 3.87, 6.47, 7.48, 7.48, 7.42, 7.41, 7.43, 7.39, 7.41, 7.39, 7.5, 7.51, 7.64, 7.62, 7.57, 7.52, 7.53, 7.47, 7.43,
"Philippines", 5.87, 5.33, 5.2, 6.01, 5.3, 5.02, 5.15, 4.92, 5.88, 7.1, 6.97, 6.76, 6.95, 7, 6.8, 7.02, 7.05, 6.86, 6.72, 6.66, 7.05, 7.22, 7.27, 7.54, 7.4, 7.43, 7.34,
"Poland", NA, NA, NA, NA, NA, NA, NA, 3.68, 3.51, 5.28, 6.55, 6.47, 6.59, 6.49, 6.81, 6.89, 6.94, 6.86, 7, 7.16, 7.12, 7.24, 7.32, 7.25, 7.43, 7.36, 7.27,
"Portugal", 5.45, 5.79, 5.98, 5.89, 5.51, 3.74, 5.62, 5.46, 6.2, 7.4, 7.46, 7.36, 7.4, 7.39, 7.44, 7.25, 7.41, 7.4, 7.21, 7.17, 7, 7.27, 7.31, 7.52, 7.6, 7.55, 7.51,
"Qatar", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.35, 7.23, 7.5, 7.54, 7.68, 7.43, 7.49,
"Romania", NA, NA, 4.26, 3.77, NA, NA, NA, 5.58, 5.02, 4.15, 5.73, 5.77, 6.31, 6.49, 6.63, 7.24, 7.03, 7.57, 7.32, 7.45, 7.3, 7.34, 7.47, 7.63, 7.74, 7.7, 7.69,
"Russia", NA, NA, NA, NA, NA, NA, NA, NA, NA, 4.33, 5.5, 5.55, 5.9, 5.98, 6.27, 6.24, 6.35, 6.45, 6.52, 6.43, 6.54, 6.56, 6.65, 6.62, 6.59, 6.65, 6.83,
"Rwanda", NA, NA, NA, 3.99, NA, 3.2, 4.6, NA, 4.89, 3.71, 5.74, 5.96, 6.31, 6.09, 5.67, 5.89, 6.38, 6.46, 6.75, 6.89, 7.23, 7.45, 7.32, 7.4, 7.43, 7.56, 7.48,
"Saudi Arabia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.71, 6.67, 6.42, 6.55, 6.55, 6.24, 6.52,
"Senegal", NA, NA, 4.08, 4.19, NA, NA, 4.85, 4.85, 5.02, 4.32, 5.61, 5.54, 5.74, 5.65, 5.7, 5.76, 5.81, 5.91, 5.87, 6.05, 5.95, 5.9, 5.9, 6.2, 6.23, 6.15, 6.22,
"Serbia", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.96, 6.39, 6.77, 6.55, 6.58, 6.56, 6.64, 6.55, 6.68, 6.71, 6.76, 6.85,
"Seychelles", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 7.24, 7.46, 7.33, 7.23,
"Sierra Leone", NA, NA, 5.09, 5.21, NA, 4.93, 4.79, 3.71, 3.81, 4.33, 4.68, 4.44, 5.06, 5.36, 5.3, 5.57, 5.63, 5.92, 5.98, 6.18, 6.22, 6.18, 6.27, 6.12, 6, 5.78, 5.75,
"Singapore", NA, NA, 6.96, 6.74, 7.08, 7.01, 7.42, 7.65, 8.49, 8.88, 8.7, 8.67, 8.79, 8.73, 8.8, 8.91, 8.98, 8.96, 8.92, 8.77, 8.76, 8.76, 8.64, 8.64, 8.84, 8.84, 8.84,
"Slovak Rep", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.42, 6.89, 6.81, 6.87, 6.95, 7.59, 7.63, 7.59, 7.6, 7.6, 7.42, 7.47, 7.48, 7.38, 7.38, 7.44, 7.24, 7.3,
"Slovenia", NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.31, 6.58, 6.81, 6.77, 6.88, 6.88, 6.91, 6.98, 6.95, 7.01, 7.02, 6.82, 6.83, 6.84, 6.75, 7.01, 7.08, 7.05,
"South Africa", 5.51, 5.93, 5.94, 5.84, 5.91, 5.23, 5.23, 5.03, 5.26, 5.9, 6.94, 6.92, 6.88, 7.02, 6.88, 6.87, 6.79, 6.79, 6.52, 6.62, 6.75, 6.82, 6.78, 6.78, 6.67, 6.64, 6.45,
"Spain", 4.98, 4.83, 5.39, 5.53, 6.12, 5.57, 5.81, 6.14, 6.56, 7.18, 7.77, 7.59, 7.5, 7.73, 7.74, 7.62, 7.57, 7.53, 7.37, 7.27, 7.32, 7.45, 7.35, 7.35, 7.45, 7.53, 7.56,
"Sri Lanka", 6.76, 5.63, 4.96, 4.88, NA, NA, 4.54, 4.71, 4.76, 6, 6.31, 6.28, 6.25, 6.39, 6.22, 6.44, 6.62, 6.43, 6.26, 6.35, 6.63, 6.77, 6.73, 6.64, 6.58, 6.63, 6.49,
"Sudan", 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, 5.36,
"Suriname", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.64, 6.35, 6.64, 6.72, 6.78, 6.85, 6.36,
"Swaziland", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.41, 6.58, 6.44, 6.56, 6.47, 6.44, 6.46,
"Sweden", 6.36, 5.79, 6.26, 6.2, 5.31, 5.34, 5.66, 6.45, 6.96, 7.32, 7.67, 7.44, 7.53, 7.61, 7.47, 7.5, 7.46, 7.43, 7.4, 7.39, 7.58, 7.57, 7.48, 7.44, 7.62, 7.65, 7.44,
"Switzerland", 7.1, 7.16, 7.22, 7.14, 7.41, 7.12, 7.62, 8.15, 8.21, 8.16, 8.73, 8.55, 8.64, 8.56, 8.5, 8.37, 8.42, 8.43, 8.24, 8.26, 8.3, 8.23, 8.2, 8.22, 8.31, 8.37, 8.39,
"Syria", 4.68, 5.55, 6.03, 5.22, 4.61, 4.88, 3.69, 3.01, 3.32, 4.08, 4.95, 5.26, 5.17, 5.13, 5.53, 5.75, 5.56, 5.96, 5.62, 5.79, 5.96, 6.18, 5.27, 4.07, 4.97, 4.96, 5.02,
"Taiwan", 3.04, 3.63, 4.5, 5.4, 6.4, 5.6, 6.32, 6.58, 7.1, 7.29, 7.29, 7.21, 7.34, 7.36, 7.55, 7.51, 7.58, 7.54, 7.49, 7.39, 7.7, 7.71, 7.71, 7.72, 7.76, 7.76, 7.89,
"Tajikistan", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.28, 6.39, 6.75, 6.55, 6.68, 6.65, 6.72,
"Tanzania", NA, NA, NA, 3.5, 4.36, 3.46, 4.33, 3.79, 3.81, 5.36, 6.11, 6.21, 6.03, 6.04, 6.04, 6.29, 6.4, 6.3, 6.2, 6.42, 6.7, 6.76, 6.62, 6.85, 6.76, 6.92, 6.92,
"Thailand", 5.5, 5.57, 5.36, 5.35, 6.2, 5.83, 5.86, 5.94, 6.69, 7.07, 6.6, 6.6, 6.67, 6.73, 6.77, 6.72, 6.86, 6.83, 6.8, 6.69, 6.65, 6.59, 6.58, 6.61, 6.62, 6.8, 6.85,
"Timor-Leste", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6, 6.89, 6.69, 6.64, 6.68, 6.6, 6.55,
"Togo", NA, NA, 4.52, 4.52, NA, NA, 3.89, 5.14, 5.31, 5.27, 5.65, 5.64, 6.03, 5.81, 5.65, 5.69, 5.87, 5.86, 5.67, 5.57, 5.55, 5.45, 5.33, 6.25, 5.79, 5.69, 5.82,
"Trinidad & Tob.", NA, 5.94, 5.99, 6, NA, 4.33, 4.88, 4.86, 5.5, 7.27, 7.58, 7.53, 7.49, 7.38, 7.15, 7.06, 6.86, 6.85, 6.74, 6.61, 6.61, 6.65, 6.6, 6.77, 6.75, 6.48, 6.73,
"Tunisia", NA, NA, 4.16, 3.71, 4.44, 4.49, 4.55, 4.37, 5.26, 5.58, 6.1, 6.16, 6.19, 6.19, 6.26, 6.37, 6.76, 6.75, 6.68, 6.71, 6.49, 6.97, 6.4, 6.35, 6.48, 6.33, 6.29,
"Turkey", 5.33, 5.13, 5.13, 5.38, 3.52, 3.83, 3.59, 4.65, 4.73, 5.69, 5.84, 5.63, 5.76, 6.16, 6.29, 6.43, 6.44, 6.54, 6.86, 6.79, 6.83, 7.03, 6.99, 6.86, 6.87, 6.84, 6.84,
"Uganda", NA, NA, NA, 5.17, NA, NA, 2.71, 2.75, 2.74, 5.09, 7.13, 7.09, 6.92, 6.92, 6.85, 6.94, 7.11, 7.14, 7.21, 7.36, 7.44, 7.26, 7.28, 7.38, 7.31, 7.3, 7.41,
"Ukraine", NA, NA, NA, NA, NA, NA, NA, NA, NA, 3.03, 4.71, 4.92, 5.4, 5.3, 5.52, 5.81, 5.95, 5.92, 5.87, 5.89, 5.9, 6.15, 6.24, 6.05, 5.91, 5.4, 5.98,
"Unit. Arab Em.", NA, NA, NA, NA, NA, NA, 6.01, 6.64, 7.23, 6.71, 7.15, 7.18, 7.4, 7.35, 7.2, 7.38, 7.58, 7.66, 7.68, 7.4, 7.56, 7.69, 7.71, 7.68, 7.56, 7.45, 7.5,
"United Kingdom", 5.56, 5.97, 6.18, 6.17, 5.94, 6.06, 6.72, 7.71, 8.18, 8.21, 8.56, 8.45, 8.46, 8.47, 8.34, 8.3, 8.2, 8.13, 7.99, 8.08, 7.89, 7.9, 7.91, 7.96, 7.91, 8.01, 8,
"United States", 7.24, 6.47, 7.13, 7.14, 7.77, 7.88, 8.07, 8.26, 8.48, 8.48, 8.62, 8.47, 8.42, 8.41, 8.42, 8.22, 8.18, 8.29, 8.17, 7.95, 7.81, 7.76, 7.88, 7.74, 7.81, 7.93, 8.03,
"Uruguay", 5.31, 5.94, 5.7, 5.38, NA, NA, 6.33, 6.16, 6.6, 6.74, 7.1, 7.04, 7.19, 7.01, 7.13, 7.05, 7, 7.08, 7.12, 7.05, 7.33, 7.39, 7.34, 7.26, 7.14, 7.15, 7.16,
"Venezuela", 5.7, 5.54, 5.69, 5.9, 7.18, 6.22, 6.72, 6.08, 5.55, 4.35, 5.89, 5.9, 4.78, 4.39, 4.91, 4.73, 4.72, 4.38, 4.22, 4.36, 3.96, 3.91, 3.82, 3.32, 3.28, 2.96, 2.88,
"Vietnam", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 5.61, 6.05, 6.19, 6.31, 6.3, 6.19, 6.45, 6.33, 6.24, 6.4, 6.37, 6.32, 6.3, 6.42,
"Yemen, Rep.", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 6.12, 6.19, 6.17, 6.33, 6.74, 6.07, 6.34,
"Zambia", NA, NA, NA, 4.51, NA, 4.11, 4.73, 3.55, 3.1, 4.76, 6.72, 6.91, 6.52, 6.79, 6.8, 6.64, 7.05, 7.13, 7.15, 7.13, 7.35, 7.34, 7.19, 6.95, 6.99, 6.74, 6.61,
"Zimbabwe", NA, NA, NA, 4.53, NA, NA, 4.5, 4.69, 4.94, 5.84, 4.51, 3.87, 3.74, 3.82, 3.25, 2.93, 2.96, 3.21, 4.55, 4.5, 4.46, 4.93, 5.06, 5.3, 5.63, 6.01, 6.06
)
es_countries = countrycode(freedom$pais, 'country.name', 'un.name.es')
freedom_es = freedom
freedom_es$pais = ifelse(is.na(es_countries), freedom$pais, es_countries)
mapeo_manual = tibble::tribble(
~pais, ~pais_es,
"Central Afr. Rep.","Republica Centroafricana",
"Hong Kong","Hong Kong (Region Administrativa Especial de China)",
"Taiwan","Taiwan (Provincia de China)",
"Unit. Arab Em.","Emiratos Arabes Unidos",
"Venezuela (República Bolivariana de)","Venezuela (Republica Bolivariana de)"
)
freedom_es = left_join(freedom_es, mapeo_manual, by='pais') %>%
mutate(pais=ifelse(is.na(pais_es), pais, pais_es)) %>% select(-pais_es)
freedom_gather = gather(freedom_es, anio, libertad_economica, -pais) %>%
mutate(anio=as.numeric(gsub('X','', anio))) %>%
filter(!is.na(libertad_economica))
#sort(unique(freedom_gather$anio))
#sort(unique(gapminder$anio))
freedom_fill <- freedom_gather %>%
group_by(pais) %>%
complete(nesting(pais), anio = seq(min(anio), max(anio), by = 1)) %>%
mutate(libertad_economica=zoo::na.locf(libertad_economica, fromLast=T))
mapeo_simple = tibble::tribble(
~pais, ~pais_new,
"Hong Kong (Region Administrativa Especial de China)","Hong Kong",
"Taiwan (Provincia de China)","Taiwan",
"Venezuela (Republica Bolivariana de)","Venezuela"
)
cruzado = inner_join(freedom_fill, gapminder, by=c('pais', 'anio')) %>%
group_by(anio) %>%
arrange(desc(libertad_economica)) %>%
mutate(rank=row_number()) %>%
arrange(libertad_economica) %>%
mutate(antirank=row_number()) %>%
left_join(mapeo_simple, by='pais') %>%
mutate(pais=ifelse(!is.na(pais_new), pais_new, pais)) %>%
select(-pais_new) %>%
mutate(label_pais = ifelse(rank < 5 | antirank < 5, pais, NA))
p = ggplot(cruzado, aes(x=libertad_economica, y=pib_per_capita, label=label_pais)) +
geom_point() +
geom_smooth() +
theme_minimal() +
ggtitle('Distribucion de PBI per capita vs Libertad economica - Año {closest_state}') +
geom_text(check_overlap = T, nudge_y = -1000) +
xlab('Indice de Libertad Economica (Fraser Institute)') +
ylab('PBI per capita') +
transition_states(anio, transition_length = 2, state_length = 2.5) +
ease_aes('sine-in-out')
a = animate(p, nframes=300, fps=30)
a
anim_save('pib_vs_libertad.gif', animation=a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment