tri_alloc: Allocate triangles within hexagons

View source: R/dhbins.R

tri_allocR Documentation

Allocate triangles within hexagons

Description

This implements the Webster/Sainte-Laguë method to allocate six triangles in each hexagon, in proportion to counts in two or more classes.

Usage

tri_alloc(countmatrix, colours, classes=colours, names = rownames(countmatrix))

Arguments

countmatrix

A matrix of counts with a column for each class and a row for each hexagon.

colours,classes

A vector of class names, or colour names with one for each class

names

A vector of names, for each row of countmatrix, to be applied to the output

Value

Matrix of class names, with six columns. The rownames will be set to names if provided.

Examples

data(dhb_cars)
tri_alloc(dhb_cars[,-1], c("green","gold","orange","goldenrod"), names=dhb_cars$dhb )
tri_alloc(dhb_cars[,-1], c("0","1","2","3+"), names=dhb_cars$dhb )


tslumley/DHBins documentation built on July 31, 2022, 11:44 p.m.