Two-dimensional tabular data structure.
$ npm install compute-data-frame
For use in the browser, use browserify.
To use the module,
var DataFrame = require( 'compute-data-frame' );
Data frame constructor. To create a new DataFrame
, provide an array
of arrays
.
var data = [
[1,2,3],
[4,5,6]
];
var df = new DataFrame( data );
The constructor also accepts the following options
:
rownames
: row namearray
. If not provided, each row name defaults to the row index.colnames
: column namearray
. If not provided, each column name defaults to the column index.
To specify options
at instantiation, provide an options object
.
var data = [
[1,2,3],
[4,5,6]
];
var rownames = [ 'beep', 'boop' ],
colnames = [ 'a', 'b', 'c' ];
var df = new DataFrame( data, {
'rownames': rownames,
'colnames': colnames
});
var DataFrame = require( 'compute-data-frame' );
To run the example code from the top-level application directory,
$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2015. Athan Reines.