stats-hooks
v0.0.1
Published
Library of react hooks for statistics purpose.
Downloads
4
Readme
stats-hooks
Library of react hooks for statistics purpose.
Install
npm install --save stats-hooks
Usage
import React, { Component } from 'react'
import { useStats, useFrequency } from 'stats-hooks'
const App = () => {
const {data, values, ascending, descending, sum, min, max, mean, median, sd} = useStats([1, 3, 2]);
// data : [1, 3, 2]
// values : [1, 3, 2]
// ascending : [1, 2, 3]
// descending : [3, 2, 1]
// sum : 6
// min : 1
// max : 3
// mean : 2
// median : 2
// sd : 0.816496580927726
const intervals = useFrequency([1, 23, 22], 10);
// {lowerBound: 0, upperBound: 10, n: 1}, {lowerBound: 10, upperBound: 20, n: 0}, {lowerBound: 20, upperBound: 30, n: 2}
}
License
MIT © nubinub