Skip to content

Commit

Permalink
update GW scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman committed Sep 9, 2023
1 parent 848e9ce commit 5c2526f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 60 deletions.
116 changes: 58 additions & 58 deletions dictionary/data_gw.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10143,64 +10143,64 @@ gwn,gwc,country,year
436,NIR,Niger,2015
436,NIR,Niger,2016
436,NIR,Niger,2017
437,CDI,Cote D\x92Ivoire,1960
437,CDI,Cote D\x92Ivoire,1961
437,CDI,Cote D\x92Ivoire,1962
437,CDI,Cote D\x92Ivoire,1963
437,CDI,Cote D\x92Ivoire,1964
437,CDI,Cote D\x92Ivoire,1965
437,CDI,Cote D\x92Ivoire,1966
437,CDI,Cote D\x92Ivoire,1967
437,CDI,Cote D\x92Ivoire,1968
437,CDI,Cote D\x92Ivoire,1969
437,CDI,Cote D\x92Ivoire,1970
437,CDI,Cote D\x92Ivoire,1971
437,CDI,Cote D\x92Ivoire,1972
437,CDI,Cote D\x92Ivoire,1973
437,CDI,Cote D\x92Ivoire,1974
437,CDI,Cote D\x92Ivoire,1975
437,CDI,Cote D\x92Ivoire,1976
437,CDI,Cote D\x92Ivoire,1977
437,CDI,Cote D\x92Ivoire,1978
437,CDI,Cote D\x92Ivoire,1979
437,CDI,Cote D\x92Ivoire,1980
437,CDI,Cote D\x92Ivoire,1981
437,CDI,Cote D\x92Ivoire,1982
437,CDI,Cote D\x92Ivoire,1983
437,CDI,Cote D\x92Ivoire,1984
437,CDI,Cote D\x92Ivoire,1985
437,CDI,Cote D\x92Ivoire,1986
437,CDI,Cote D\x92Ivoire,1987
437,CDI,Cote D\x92Ivoire,1988
437,CDI,Cote D\x92Ivoire,1989
437,CDI,Cote D\x92Ivoire,1990
437,CDI,Cote D\x92Ivoire,1991
437,CDI,Cote D\x92Ivoire,1992
437,CDI,Cote D\x92Ivoire,1993
437,CDI,Cote D\x92Ivoire,1994
437,CDI,Cote D\x92Ivoire,1995
437,CDI,Cote D\x92Ivoire,1996
437,CDI,Cote D\x92Ivoire,1997
437,CDI,Cote D\x92Ivoire,1998
437,CDI,Cote D\x92Ivoire,1999
437,CDI,Cote D\x92Ivoire,2000
437,CDI,Cote D\x92Ivoire,2001
437,CDI,Cote D\x92Ivoire,2002
437,CDI,Cote D\x92Ivoire,2003
437,CDI,Cote D\x92Ivoire,2004
437,CDI,Cote D\x92Ivoire,2005
437,CDI,Cote D\x92Ivoire,2006
437,CDI,Cote D\x92Ivoire,2007
437,CDI,Cote D\x92Ivoire,2008
437,CDI,Cote D\x92Ivoire,2009
437,CDI,Cote D\x92Ivoire,2010
437,CDI,Cote D\x92Ivoire,2011
437,CDI,Cote D\x92Ivoire,2012
437,CDI,Cote D\x92Ivoire,2013
437,CDI,Cote D\x92Ivoire,2014
437,CDI,Cote D\x92Ivoire,2015
437,CDI,Cote D\x92Ivoire,2016
437,CDI,Cote D\x92Ivoire,2017
437,CDI,Cote D’Ivoire,1960
437,CDI,Cote D’Ivoire,1961
437,CDI,Cote D’Ivoire,1962
437,CDI,Cote D’Ivoire,1963
437,CDI,Cote D’Ivoire,1964
437,CDI,Cote D’Ivoire,1965
437,CDI,Cote D’Ivoire,1966
437,CDI,Cote D’Ivoire,1967
437,CDI,Cote D’Ivoire,1968
437,CDI,Cote D’Ivoire,1969
437,CDI,Cote D’Ivoire,1970
437,CDI,Cote D’Ivoire,1971
437,CDI,Cote D’Ivoire,1972
437,CDI,Cote D’Ivoire,1973
437,CDI,Cote D’Ivoire,1974
437,CDI,Cote D’Ivoire,1975
437,CDI,Cote D’Ivoire,1976
437,CDI,Cote D’Ivoire,1977
437,CDI,Cote D’Ivoire,1978
437,CDI,Cote D’Ivoire,1979
437,CDI,Cote D’Ivoire,1980
437,CDI,Cote D’Ivoire,1981
437,CDI,Cote D’Ivoire,1982
437,CDI,Cote D’Ivoire,1983
437,CDI,Cote D’Ivoire,1984
437,CDI,Cote D’Ivoire,1985
437,CDI,Cote D’Ivoire,1986
437,CDI,Cote D’Ivoire,1987
437,CDI,Cote D’Ivoire,1988
437,CDI,Cote D’Ivoire,1989
437,CDI,Cote D’Ivoire,1990
437,CDI,Cote D’Ivoire,1991
437,CDI,Cote D’Ivoire,1992
437,CDI,Cote D’Ivoire,1993
437,CDI,Cote D’Ivoire,1994
437,CDI,Cote D’Ivoire,1995
437,CDI,Cote D’Ivoire,1996
437,CDI,Cote D’Ivoire,1997
437,CDI,Cote D’Ivoire,1998
437,CDI,Cote D’Ivoire,1999
437,CDI,Cote D’Ivoire,2000
437,CDI,Cote D’Ivoire,2001
437,CDI,Cote D’Ivoire,2002
437,CDI,Cote D’Ivoire,2003
437,CDI,Cote D’Ivoire,2004
437,CDI,Cote D’Ivoire,2005
437,CDI,Cote D’Ivoire,2006
437,CDI,Cote D’Ivoire,2007
437,CDI,Cote D’Ivoire,2008
437,CDI,Cote D’Ivoire,2009
437,CDI,Cote D’Ivoire,2010
437,CDI,Cote D’Ivoire,2011
437,CDI,Cote D’Ivoire,2012
437,CDI,Cote D’Ivoire,2013
437,CDI,Cote D’Ivoire,2014
437,CDI,Cote D’Ivoire,2015
437,CDI,Cote D’Ivoire,2016
437,CDI,Cote D’Ivoire,2017
438,GUI,Guinea,1958
438,GUI,Guinea,1959
438,GUI,Guinea,1960
Expand Down
5 changes: 3 additions & 2 deletions dictionary/get_gw.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source(here::here('dictionary/utilities.R'))
url <- "http://ksgleditsch.com/data/iisystem.dat"

gw <- readr::read_tsv(url,
locale = locale(encoding = "windows-1252"),
col_names = c("gwn", "gwc", "country", "birth", "death"),
col_types = cols(gwn = readr::col_integer(),
gwc = readr::col_character(),
Expand All @@ -20,12 +21,12 @@ gw <- gw %>%
country = gsub(" \\(Annam.*", "", country)
) %>%
# ambiguous or not covered
filter(!gwc %in% c("TBT", "DRV", "HSD", "HSE", "WRT", "UPC", "TRA")) %>%
filter(!gwc %in% c("TBT", "DRV", "HSD", "HSE", "WRT", "UPC", "TRA")) %>%
mutate(idx = 1:n()) |>
group_by(idx) |>
mutate(panel = list(year(birth):year(death))) %>%
ungroup() |>
unnest(panel) |>
unnest(panel) |>
select(-idx, -birth, -death) |>
rename(year = panel) |>
# arbitrary
Expand Down

0 comments on commit 5c2526f

Please sign in to comment.