Compare a dataset retrieved with fetch_indicator() with WDI.

compare_with_wdi(df)

Arguments

df

data.frame: A pddcs formatted data frame. Output of fetch_indicator().

Value

list

Details

[Stable]

compare_with_wdi() returns a list of three data frames; the original dataset (source), the data retrieved from WDI (wdi) and the rows in the source dataset that are not present in WDI (not_in_wdi).

Examples

# Compare SH.MLR.NETS.ZS data from UNICEF with WDI
data("bednets")
dl <- compare_with_wdi(bednets)
str(dl)
#> List of 3
#>  $ source    : tibble [239 × 6] (S3: tbl_df/tbl/data.frame)
#>   ..$ iso3c    : chr [1:239] "AFG" "AGO" "AGO" "AGO" ...
#>   ..$ year     : num [1:239] 2015 2007 2011 2016 2000 ...
#>   ..$ indicator: chr [1:239] "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" ...
#>   ..$ value    : num [1:239] 4.6 18 25.9 21.7 1 1 8 45.3 53.8 39.9 ...
#>   ..$ note     : chr [1:239] "Demographic and Health Survey 2015" "Other National Survey 2006-2007" "Malaria Indicator Survey 2011" "Demographic and Health Survey 2015-2016" ...
#>   ..$ source   : chr [1:239] "unicef" "unicef" "unicef" "unicef" ...
#>   ..- attr(*, ".internal.selfref")=<externalptr> 
#>  $ wdi       :'data.frame':	13237 obs. of  5 variables:
#>   ..$ iso3c    : chr [1:13237] "ABW" "ABW" "ABW" "ABW" ...
#>   ..$ year     : num [1:13237] 1960 1961 1962 1963 1964 ...
#>   ..$ indicator: chr [1:13237] "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" ...
#>   ..$ value    : num [1:13237] NA NA NA NA NA NA NA NA NA NA ...
#>   ..$ source   : chr [1:13237] "wdi" "wdi" "wdi" "wdi" ...
#>  $ not_in_wdi: tibble [47 × 6] (S3: tbl_df/tbl/data.frame)
#>   ..$ iso3c    : chr [1:47] "AGO" "BDI" "BEN" "BEN" ...
#>   ..$ year     : num [1:47] 2007 2010 2006 2018 2003 ...
#>   ..$ indicator: chr [1:47] "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" "SH.MLR.NETS.ZS" ...
#>   ..$ value    : num [1:47] 18 45.3 20 69.8 2 1 41.2 6 26.3 2 ...
#>   ..$ note     : chr [1:47] "Other National Survey 2006-2007" "Demographic and Health Survey 2010" "Demographic and Health Survey 2006" "Demographic and Health Survey 2017-2018" ...
#>   ..$ source   : chr [1:47] "unicef" "unicef" "unicef" "unicef" ...
#>   ..- attr(*, ".internal.selfref")=<externalptr>