[Experimental] Creates and returns a new Datawrapper Chroropleth map object. This function starts the map-making process

dw_create_choropleth_map(
  basemap_id,
  basemap_value,
  values_col,
  keys_col,
  api_key = "environment",
  title = "",
  tooltip = list(title, body, fields = c()),
  folderId = ""
)

Arguments

basemap_id

Required. Can be retrieved by looking at dw_basemaps.

basemap_value

Required. Can be retrieved by looking at dw_basemaps.

keys_col

Required. Which column contains the keys for the map (as specified in dw_basemaps)?

api_key

Required. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by datawrapper_auth.

title

Optional. Will set a map's title on creation.

tooltip

Optional. Specify a list including these vectors: title, body, fields. Include all used variables in fields. Use " variable name " as placeholders in title and body.

folderId

Optional. Creates chart in specified folder.

value_col

Required. Which column contains the values to be plotted on the map?

Value

It prints the new chart's id and returns a S3-structure of type dw_chart with the elements from the Datawrapper-API, the same as in dw_retrieve_chart_metadata. After creating the chart you can populate and update it with dw_data_to_metadata

Note

If not specified, the new chart will by default be created without a title.

Author

Benedict Witzenberger

Examples

## Simple example: if (FALSE) { dw_create_choropleth_map( basemap_id = "world-2019", basemap_value = "DW_STATE_CODE", value_cols = "percentage", key_cols = "iso_codes" ) } ## Include a tooltip: if (FALSE) { dw_create_choropleth_map( basemap_id = "world-2019", basemap_value = "DW_STATE_CODE", value_cols = "percentage", key_cols = "iso_codes", tooltip = list( title = "{{ State_Name }}", body = "In {{ State_Name }} the value is {{percentage}} percent.", fields = c("State_Name", "percentage") )) }