Learn R Programming

CME.assistant

The goal of CME.assistant is to collect some frequently used functions. This package is made non-private since it only attaches published final estimates for the recent 2 years.

Installation

To install from github:

  • Examples in the vignettes, set build_vignettes = TRUE
  • Maybe need to add build_opts = "--no-multiarch" if encounter Java-related problem according to this post
devtools::install_github("unicef-drp/CME.assistant")
# or if needed,
devtools::install_github("unicef-drp/CME.assistant", build_vignettes = TRUE, build_opts = "--no-multiarch")
library(CME.assistant)

Alternative option: download the repo, and use 'Ctrl/Cmd+Shift+B' to compile the package locally.

To view vignette

devtools::install_github("unicef-drp/CME.assistant", build_vignettes = TRUE)
vignette(package = "CME.assistant")
vignette("CMEvignette1")

Copy Link

Version

Install

install.packages('CME.assistant')

Monthly Downloads

35

Version

1.1.4

License

MIT + file LICENSE

Maintainer

Yang Liu

Last Published

March 22nd, 2021

Functions in CME.assistant (1.1.4)

check.CC.profile.data

Compare CC profile tables to "results.csv"
Rates_Deaths_Country_Summary_2019_UI

Rates_Deaths_Country_Summary_2019_UI: The 2019 final estimates with UI
check.and.install.pkgs

Check and install packages if missing
add.new.series.u5mr

Add new U5MR or IMR entries (dt_new_entries)
add.new.series.imr

Add new IMR entries (dt_new_entries), now the same function as `add.new.series.u5mr`
add.Original.Series.Name

Add an original series name
compare.results.vs.cqt

Compare the saved cqt vs results
Rates_Deaths_Country_Summary_2020_UI

Rates_Deaths_Country_Summary_2020_UI: The 2020 final estimates with UI Please refer to childmortality.org for details
UNICEF_colors

UNICEF_colors load UNICEF color palette Load UNICEF blue, Sequential, Diverging, Qualitative, and grays scheme into the global environment
add.new.series.nmr

Add new NMR entries (`dt_new_entries`)
get.IGMEinput.dir

Get "input" dir for a given year
get.opt.dir

Get optimal file directory from `Output CMRJack` folder
rbinddatasetNMR

Row-bind two datasets for NMR with slight changes, check duplicated keys, set order
get.raw.dir

get raw file directory from `Output CMRJack` folder
get.IGMEoutput.dir

Get "output" dir for a given year
read.all.results.csv

Read all "results.csv"
find_latest_date

Find out the latest date of all the master files in the directory using the dates in file names
get.0_4.sources

Get survey names for Table Under 5
get.5_24.sources

Get survey names (sources) for 5 to 24
create.IGME.key

Create IGME_Key column
dropbox_project_sync_off

let dropbox untrack `Rproj user` folder Solve Dropbox conflicts with `Rproj.user` revised base on: https://community.rstudio.com/t/dropbox-conflicts-with-rproj-user/54059
get.CME.UI.data

Return different format of the final aggregate results country summary
get.cqt.from.results

Make cqt file from `results.csv` file
get.dir_gender

Get the sex-specific master dataset directory
get.table.by.iso

Get CC profile data by country
get.dir_U5MR

Get the U5MR master dataset directory
get.IGMEfig.dir

Get "fig" dir for a given year
get.IGME.dir

Get IGME "Code" dir for a given year
get.dt.cqt

Collect data from the cqt file for plotting
default_label

a place holder, supply and it will be used in the `get.match` function
ggsave.figs

Use `ggsave` to save figs in both png and pdf
new_cnames

new_cnames: the official country names: ISO3Code UNCode OfficialName
read.region.summary

function to read regional summary and output long format
get.ref.date

Calculate start, end and average date in decimal from starting/end dates
search.for.file

Search for file paths matched by part of the file name
read.country.summary

function to read "Rates & Deaths_Country Summary.csv" and output long format
load.IGMEoutput.dir

load the IGME "output" directories
read.results.csv.file

Read one results.csv file and reformat into long-format
load.final_dir

Return a saved dir_list for total and sex-specific Rates & Deaths_Country Summary.csv
hiv.iso

hiv.iso: the 17 hiv isos
revise.age.group

Remove 25-34 age group in `dt_new_entries`
get.dir_IMR

Get the IMR master dataset directory
get.cqt.from.aggfinal

Get cqt file from final aggregated results for plotting, based on the long-formatted final results
get.country.info

Load the country info file, requires dt object `country_info`
leap_year

leap year: if this is a leap year
get.file.name

Show all file directories within the file directory `dir_file` and matched by pattern `pattern0`
get.dir_NMR

Get the NMR master dataset directory
get.new.sourceID

Format the legend_ID for the master datasets
shortind_indicator

shortind_indicator: match shortind to full indicator names
get.max.date

Internal function to check if the input is date, and figure out which date is the latest
final_dir_list

final_dir_list: saved dir list of final results, could also be obtained using `load.final_dir()`
upper.first.letter

Capitalize first letter of each word in the vector
roundoff

A rounding function that round off numbers in the conventional way
revise.path

Adjust the file dir if the lash is not right or the dropbox username is not right (YL 2020/2)
get.match

A label function to replace values by a given list in a variable
rbinddataset

Row-bind two datasets, check duplicated keys and set order
load.IGMEinput.dir

Load the IGME "input" directories
save.CME.CC.profile

Save CMR CC profile by country