Description Usage Arguments Details Examples
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.
1 2 3 4 |
data |
A |
country |
country name. If |
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. |
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()
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.