data_map_prep: General function for processing geographic data

data_map_prepR Documentation

General function for processing geographic data

Description

General function for processing geographic data

Usage

data_map_prep(
  data,
  ftype,
  agg,
  color_by = NULL,
  ptage = FALSE,
  ptage_col = NULL,
  more_levels = FALSE,
  group_extra_num = TRUE,
  cluster = FALSE
)

Arguments

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

Examples


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)


datasketch/dsvizprep documentation built on Feb. 11, 2023, 1:11 a.m.