50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

tmap (version 0.6)

calc_densities: Calculate densities

Description

This function transposes quantitiy variables to densitiy variables, which are needed for choroplets.

Usage

calc_densities(shp, var, total.area.km2 = NA, drop = TRUE)

Arguments

shp
a shape object
var
name(s) of a qualtity variable name contained in the map data
total.area.km2
total area size of shp in number of squared kilometers. If NA, and unit="km2", then the polygon coordinates are assumed to be in meters.
drop
boolean that determines whether an one-column data-frame should be returned as a vector

Value

  • vector or data.frame (depending on whether length(var)==1 with density values. This can be appended directly to the shape file.