@njam-data/diversity-index

1.0.0 • Public • Published

@njam-data/diversity-index

Based on the USA Today diversity index.

Install

npm i @njam-data/diversity-index

Examples

creating an index from one factor

const race = [0.7, 0.3]
const result = diversityIndex([
  race
])
console.log('result', result)
// result === 0.42

creating an index from two factors

const race = [0.3, 0.2, 0.1, 0.5]
const ethnicity = [0.1, 0.9]
const result = diversityIndex([
  race,
  ethnicity
])
console.log('result', result)
// result === 0.75

See also

Readme

Keywords

none

Package Sidebar

Install

npm i @njam-data/diversity-index

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

2.49 kB

Total Files

4

Last publish

Collaborators

  • sethvincent