data_map_prep | R Documentation |
General function for processing geographic data
data_map_prep( data, ftype, agg, color_by = NULL, ptage = FALSE, ptage_col = NULL, more_levels = FALSE, group_extra_num = TRUE, cluster = FALSE )
data |
A data frame with geografical info. |
ftype |
A string value with type of data to be plotted |
agg |
Statistics which can be applied to all data subsets (sum, mean, median) |
color_by |
A character with the name of the variable by which you want to color the graph. Default is NULL |
ptage_col |
A string value with the name of the categorical variable against which the percentage is calculated. |
more_levels |
A logical indicating if the map has more than one territorial level. |
group_extra_num |
A logical indicating |
df <- sample_data("Gnm-Cat-Num") data_map_prep(data = df, ftype = "Gnm-Cat-Num". agg = "sum") df <- data.frame(id = "COL", "URY", "ARG") df$id <- as_Gnm(df$id) data_map_prep(data = df, ftype = "Gcd". agg = "mean") df <- sample_data("Gnm-Gcd-Num-Cat-Cat-Num") data_map_prep(data = df, ftype = "Gnm-Num", agg = "sum", more_levels = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.