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

21 lines (16 loc) 903 B
import { describe, it } from 'node:test'; import assert from 'node:assert'; import Statistics from '../lib/index.js'; describe('Statistics.columns(...)', () => { it('собирает одноимённые колонки из нескольких таблиц безопасно', () => { const S = new Statistics('S'); const t1 = S.addTable({ id: [1,2,3], age: [10,20,30] }, { name: 't1' }); const t2 = S.addTable({ id: [4,5,6], salary: [100,200,300] }, { name: 't2' }); // В t2 нет age, а в t1 нет salary — не должно падать: const ages = S.columns('ages', 'age'); assert.deepEqual(ages.colNames.sort(), ['t1_age'].sort()); assert.deepEqual(ages.columns['t1_age'].values, [10,20,30]); const both = S.columns('both', 'age', 'salary'); assert.deepEqual(both.colNames.sort(), ['t1_age','t2_salary'].sort()); }); });