18  Altres

18.1 Dades econòmiques històriques

library(haven)
mad <- read_dta("https://www.rug.nl/ggdc/historicaldevelopment/maddison/data/mpd2020.dta")

mad %>%
  filter(country %in% c("France", "Zambia", "Chad"),
         year %in% c(1, 1789, 2000)) %>%
    transmute(País = countrycode(country, "country.name.en", "cldr.name.ca"),
              Any = year, PIBcap = round(gdppc), Pop = round(pop))

18.2 Desigualtat

library(devtools)
install_github("WIDworld/wid-r-tool")
library(wid)

wid <- download_wid(
   indicators = "sfiinc", #seleccionem indicador
   areas = c("FR", "CN", "US", "DE", "GB", "RU"), #seleccionem països
   perc = "p99p100", #seleccionem percentil
   ) %>% as_tibble()

wid %>%
  ggplot(aes(x = year, y = value, col = country)) +
  geom_point(alpha = 0.2) +
  geom_smooth(se = FALSE)

18.3 Povcalnet

Has instal·lat els paquets?

Recorda que per utilitzar un paquet, aquest ha d’estar prèviament instal·lat a RStudio. Si no has instal·lat algun d’aquests paquets, ara és el moment de fer-ho:

install.packages(c("dplyr", "readr", 
                   "ggplot2", "povcalnetR"))