Skip to contents

A complete, renderer-agnostic choropleth dataset: a list of MapRow objects, the administrative resolution that selects the geometry, the label for the value column, and the ordered tooltip field names. The R analog of the MapModel TypeScript interface in rtemislive (~/Code/live/src/lib/types.ts), consumed by the rtemis-map htmlwidget.

Usage

MapModel(
  rows = list(),
  resolution = "country",
  value_label = "value",
  tooltip_fields = character(0)
)

Arguments

rows

List: List of MapRow objects.

resolution

Character {"country", "state", "county"}: Administrative resolution. "country" joins on ISO-A3, "state" on 2-digit FIPS, "county" on 5-digit FIPS.

value_label

Character: Display label for the value column (labels the legend and tooltip value).

tooltip_fields

Character: Ordered names of the extra fields to show in the tooltip (keys into each MapRow's extras).

Value

MapModel object.

Details

Most users build this implicitly through draw_choropleth(); the constructor is exported for power users who assemble rows directly.

Examples

MapModel(
  rows = list(
    MapRow(location = "USA", value = 25.5),
    MapRow(location = "CAN", value = 12.1)
  )
)
#> <rtemis.draw::MapModel>
#>  @ rows          :List of 2
#>  .. $ : <rtemis.draw::MapRow>
#>  ..  ..@ location: chr "USA"
#>  ..  ..@ value   : num 25.5
#>  ..  ..@ extras  : NULL
#>  .. $ : <rtemis.draw::MapRow>
#>  ..  ..@ location: chr "CAN"
#>  ..  ..@ value   : num 12.1
#>  ..  ..@ extras  : NULL
#>  @ resolution    : chr "country"
#>  @ value_label   : chr "value"
#>  @ tooltip_fields: chr(0)