Skip to content

dstructs/data-frame

Repository files navigation

data-frame

NPM version Build Status Coverage Status Dependencies

Two-dimensional tabular data structure.

Installation

$ npm install compute-data-frame

For use in the browser, use browserify.

Usage

To use the module,

var DataFrame = require( 'compute-data-frame' );

DataFrame( arr[, opts] )

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 name array. If not provided, each row name defaults to the row index.
  • colnames: column name array. 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	
});

Examples

var DataFrame = require( 'compute-data-frame' );

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

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.

Test Coverage

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

License

MIT license.

Copyright

Copyright © 2015. Athan Reines.

About

Two-dimensional tabular data structure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published