flag_fillr_data: Use flags to plot a ggplot2 map

Description Usage Arguments Details Examples

Description

flag_fillr_data uses user-supplied data to get flags as a fill for a map of a particular country. It wil lplot the map for thee.

Usage

1
2
3
4
flag_fillr_data(data = NULL, country = NULL, partner_col = NULL,
  resolution = c("small", "large"), type = c("country", "state"),
  size = c("100", "250"), state_col = NULL, country_col = NULL,
  mainland_only = TRUE)

Arguments

data

A data.frame, see details.

country

country name. If country is NULL, you must supply a country_col.

partner_col

column of partner countries. See details.

resolution

detail of rnaturalearth data.

type

will you be plotting flags on countries or inside countries, on the states?

size

size of flag image.

state_col

column of state names. Must be full names, see details.

country_col

column of country names. See details.

mainland_only

remove non-contiguous landmasses? Will remove places like Alaska, Hawaii, etc.

Details

This function accepts a data.frame that must contain at least two columns: one for the base territory (i.e. the area that will be mapped), and another for the names of the countries whose flags will be used as fills in the map. If the goal is to fill states inside of one country, the base territory column should be called "state"; if you want to map entire countries with one fill, it should be called "country". The column of the flags to be used should be called "partner". If you would rather not rename the columns in your data, you can specify the 'partner' (partner_col), 'state' (state_col), and 'country' (country_col) columns. These must be the actual columns, written in the format df$state, where df is your data.frame and state is the 'state' column (with whatever name you have for it). For information on acceptable country names, see country_list().

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
 us_data <- data.frame(
   state = state.name, # I love R!
   partner = c(rep("Mexico", 15), rep("Canada", 25), rep("China", 8), rep("Japan", 2)),
   stringsAsFactors = FALSE
  )
  flag_fillr_data(us_data, country = "United States of America", type = "state", size = "250")

## End(Not run)

RobertMyles/flagfillr documentation built on May 27, 2019, 1:08 a.m.