tri_alloc: Allocate triangles within hexagons

Description Usage Arguments Value Examples

View source: R/dhbins.R

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

1
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

1
2
3
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 )

DHBins documentation built on Dec. 18, 2019, 5:07 p.m.