lookup_colors: Create a palette for ggplot2 use, using lookup using...

Description Usage Arguments Value Warning Examples

Description

Create a palette for ggplot2 use, using lookup using GitHub-based CSV file

Usage

1
2
3
lookup_colors(data_for_lookup, category_vars = c(all_factors(),
  all_characters()), lookup_file = "lookup_coloration_table.csv",
  path = "https://raw.githubusercontent.com/CSISdefense/hamre_lookups/master/")

Arguments

data_for_lookup

A data frame

category_vars

A vector containing the quoted names of the variables for which to set colors. Any category variable that may be used as a breakout should be included. By default, includes all factor or character variables.

lookup_file

The quoted file name of the color lookup to use; must be a CSV with the columns "variable" and "hexvalue".

path

The path or url for the data_for_lookup CSV. By default, checks the CSISdefense Github lookups repository at CSISdefense/hamre_lookups/master

Value

Returns a named vector of hex values, suitable for use with ggplot functions such as scale_color_manual() and scale_fill_manual()

Warning

This function should be ideally be used in data processing, to create a colorset vector that will be saved in a .Rda file for app use. If you want to use it directly in an app, make sure it only runs once - over the full data set - at app startup. It reads an external (GitHub) file and is not optimized for speed.

Examples

1
2
3
4
RDTE_data <- deflate(
  data_to_deflate = RDTE_data,
  money_var = "Millions",
  fy_var = "fiscal_year")

CSISdefense/hamre documentation built on May 31, 2019, 7:58 a.m.