README.md

c4aRs

This package is a convenient location for R resources to be used by C4ADS analysts.

Installation

  1. Install devtools if not already installed with install.packages('devtools').
  2. Install c4aRs using devtools using the command devtools::install_github('C-Research/c4aRs').
  3. You may be prompted to install some updates to different packages. You should update all packages, but make sure to not install the stringi update, as this will cause your installation to fail. To install all but stringi, enter the number for each package separated by a space.
  4. Done!

Century Gothic

The ggplot2 resources used in this package rely on the use of the 'Century Gothic' font. To make Century Gothic available to R, you must first install Century Gothic on your computer, and then run extrafont::font_import() to import the new font.

Usage

Seizure Data

There are a few functions in this package that assist cleaning seizure data. Each function is documented, and you can access them using the command ??c4aRs::function_name, replacing function_name with the name of the function you are curious about.

One function is selectByMultCols. This function will filter a dataset by a number of columns, searching for a number of values. So, for instance, if you were looking for any seizure with an origin or destination of "Mexico" or "China", you would just call, selectByMultCols(data, c('OriginCountry', 'DestinationCountry'), c('Mexico', 'China'))

Another exampe is traffickingInstanceCount, which will count return a dataframe of trafficking instance counts based values in user-defined columns. For example, to find the number of TIs for each country in a dataset, you would run traffickingInstanceCount(data, c('OriginCountry', TransitCountry, 'DestinationCountry')). Note, this will count the number of rows that each country appears in, so is inconsistent with the ROUTES method of TI calculation.

ggplot2 theme

When c4aRs is loaded, our theme is automatically loaded, so it will be applied to any ggplot that you create automatically. If 'Century Gothic' is not installed, the graphs will not render. If you want to use the theme, and also add additional elements, you can add it to a plot using theme_c4ads().

Colors

The C4ADS colors are also available in Hex code form in the c4aRs package. They are presented in the following objects.



C-Research/c4aRs documentation built on Sept. 2, 2021, 1:10 p.m.