Giter Site home page Giter Site logo

c4ars's Introduction

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.

  • c4_cols - a named vector of all the C4 base colors.
  • c4_col_gradients - a named list of all the c4 base colors, along with 3 lighter hues for each color.
  • c4_col_leafy - a vector of all the colors in the leafy palette.
  • c4_col_spooky - a vector of all the colors in the spooky palette.
  • c4_col_dusty - a vector of all the colors in the dusty palette.

c4ars's People

Contributors

mmkearns16 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.