Skip to contents

This function generates a ggplot object for a specified plot key and country ISO3 code, or returns the plot's metadata if iso is NULL.

Usage

digest_plot(key, iso = NULL, ...)

Arguments

key

Character. The plot key identifying which plot to generate. Must correspond to a function named plot_<key> in the amerdigest package.

iso

Character or NULL. ISO3 country code for which to generate the plot. If NULL, the function returns plot metadata instead of a plot.

...

Additional arguments passed to the plot generating function.

Value

A ggplot object if iso is provided, or a list containing plot metadata if iso is NULL.

Examples

# Generate a plot for USA
p1 <- digest_plot(key="regflow", iso = "USA")

p1

# Test error catching
p2 <- digest_plot(key="regnet", iso = "USA")
p2