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

13 lines (12 loc) 535 B
import { filterKeys } from '../../utils/filter-keys.js'; export function clone(newName, colFilter = [], table) { const { options, name, columns, Table } = table const clonedTable = new Table({}, { ...options, name: newName || name + '-clone' }) const colNames = filterKeys(table.colNames, colFilter) colNames.forEach(colName => { const values = columns[colName].values const labels = columns[colName].labels?.slice() clonedTable.addColumn(colName,values, labels) }) return clonedTable }