The goal of CME.assistant is to share reusable helper functions within the CME team. Also feel free to download, further revise and compile locally.
options(rmarkdown.html_vignette.check_title = FALSE)
library(CME.assistant)
#> Loading required package: data.table
Choose output format among raw, long, wide_year and wide_ind, default to “long”
* The long-format dataset contains Official Name, ISO3Code, Indicator, Year, Quantile, Sex * The function will output all available indicators in the dataset * Optional: subset by country ISO (c_iso
) or year (year_range
)
get.CME.UI.data
# without supplying dir_file, by default returns the published IGME 2020 final
# results
dt_1 <- get.CME.UI.data(use_IGME_year = 2020)
#> Indicators:U5MR, IMR, NMR, Under.five.Deaths, Infant.Deaths, Neonatal.Deaths
head(dt_1)
#> OfficialName ISO3Code Indicator Year Quantile Sex Value
#> 1: Afghanistan AFG IMR 1990 Lower Total 111.2
#> 2: Afghanistan AFG IMR 1990 Median Total 120.4
#> 3: Afghanistan AFG IMR 1990 Upper Total 130.9
#> 4: Afghanistan AFG IMR 1991 Lower Total 108.2
#> 5: Afghanistan AFG IMR 1991 Median Total 116.8
#> 6: Afghanistan AFG IMR 1991 Upper Total 126.2
dir_cqt_files <- file.path(CME.assistant::get.IGME.dir(2020),
"figData/cqt_backup")
list.files(dir_cqt_files)
dt_cqt <- get.dt.cqt(dir_cqt_files)
dt_cqt[, table(Shortind, Sex)]
# table to be added into the profile by country:
dt1 <- get.table.by.iso(iso0 = "AFG")
Automatically point to the latest file using the date in file names
get.match
# a helpful function to revise variable, you can provide a __new_list__ to define the labels
get.match(c("a","b", "c"), new_list = list("a" = "new label 1",
"b" = "new label 2"))
#> [1] "new label 1" "new label 2" "c"
UNICEF_colors
str(UNICEF_colors)
#> List of 5
#> $ UNICEF_blue : chr "#1CABE2"
#> $ cp_UNICEF_seq : chr [1:8] "#002759" "#00377D" "#0058AB" "#0083CF" ...
#> $ cp_UNICEF_div : chr [1:10] "#002759" "#0058AB" "#1CABE2" "#69DBFF" ...
#> $ cp_UNICEF_qua : chr [1:10] "#0058AB" "#1CABE2" "#00833D" "#80BD41" ...
#> $ cp_UNICEF_grays: chr [1:5] "#333333" "#6B6B6B" "#B3B3B3" "#D7D7D7" ...