UNPKG

als-statistics

Version:

Modular JS statistics toolkit for Node.js and the browser: descriptive stats, correlations (Pearson/Spearman/Kendall), t-tests & ANOVA (Student/Welch), reliability (Cronbach’s alpha), regression (linear/logistic), clustering (DBSCAN/HDBSCAN), and table/co

17 lines (15 loc) 580 B
import range from '../utils/range.js' export function prepare(values, labels) { if (values && values.constructor.name === 'Column') { if (!labels || labels.length === 0) labels = values.labels values = values.values.slice() } if ((!values || values.length === 0) && labels && labels.length) values = range(0, labels.length, 1) const invalid = []; values = values.filter((v, i) => { if (typeof v === 'number' && Number.isFinite(v)) return true invalid.push(i) return false }) return { values, labels, invalid } }