Methods Available
All the methods work with an array of objects (i.e [{age:45},{age:51},{age:67},{age:56}]
)
- getMean
- getMedian
- getMode
- getVariance (both sample & population variance)
- getStandardDeviation (both sample & population deviation)
- getBounds
- getRange
- getQuartiles
- getInterquatileRange
- getUnique
- getFrequencyTable
- getValues
- convert
- getProps
- getPropTypes
Usage.
var stats = require('analyze-stats');
var data = [{age:45},{age:51},{age:67},{age:56}]
//to get mean
stats.getMean(data)
//to get Median
stats.getMedian(data)
If you have data that has mixed type e.g [{age:45},{age:51},{age:'67'},{age:56}]
. Note the 67 is a string
You can convert the data to a specific type using. Note you have to set the properties that you want to convert in an array of strings
var data = [{age:45},{age:51},{age:'67'},{age:56}];
stats.convert(data,['age']).toIntegers()
// or
stats.convert(data,['age']).toStrings()
// or
stats.convert(data,['age']).toFloats()
//you can also set the number of descimal places when converting to floats
stats.convert(data,['age']).toFloats(3)