How to use the linq.range function in linq

To help you get started, we’ve selected a few linq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github data-forge / data-forge-js / package-test / npm / index.js View on Github external
'use strict';

var dataForge = require('data-forge');
var E = require('linq');

// 
// Create a simple data frame.
//
var values = E
	.range(0, 14)
	.select(function (i) {
		return [i, Math.sin(i), Math.cos(i)];
	})
	.toArray();

var dataFrame = new dataForge.DataFrame({
		columnNames: ["index", "Sin", "Cos"], 
		rows: values
	})
	.setIndex("index")
	.dropSeries("index");

console.log(dataFrame.skip(4).take(5).toString());

var series = dataFrame.getSeries("Sin");
github data-forge / data-forge-js / examples / 1. display data frame - console / index.js View on Github external
'use strict';

var dataForge = require('../../index.js');
var E = require('linq');

// 
// Create a simple data frame.
//
var values = E
	.range(0, 14)
	.select(function (i) {
		return [i, Math.sin(i), Math.cos(i)];
	})
	.toArray();

var dataFrame = new dataForge.DataFrame({
		columnNames: ["index", "Sin", "Cos"], 
		rows: values 
	})
	.setIndex("index")
	.dropSeries("index");

console.log(dataFrame.skip(4).take(5).toString());

var series = dataFrame.getSeries("Sin");
github data-forge / data-forge-js / src / lazydataframe.js View on Github external
getIterator: function () {
					return new ArrayIterator(E.range(0, self.toValues().length).toArray());
				},
			});
github data-forge / data-forge-js / src / dataframe.js View on Github external
.select(function (column) {
			var numValues = column.series.toArray().length;
			//todo: broad-cast column
			var newSeries = new Series({
				values: E.range(0, numValues)
					.select(function () { 
						return column.name 
					})
					.toArray()
			});
			return column.series.detectValues().withSeries('Column', newSeries);
		})
		.toArray();
github data-forge / data-forge-js / src / basedataframe.js View on Github external
getIterator: function () { //todo: broad-cast index
				return new ArrayIterator(E.range(0, self.toValues().length).toArray());
			},
		}),
github data-forge / data-forge-js / src / basedataframe.js View on Github external
.selectMany(function (data) {
						var index = data[0];
						var values = data[1];
						return E.range(0, values.length)
							.select(function (_) {
								return index;
							})
							.toArray();
					})
					.toArray();
github data-forge / data-forge-js / src / lazydataframe2.js View on Github external
function () {
					return E.range(0, self.getValues().length).toArray();
				}
			);
github data-forge / data-forge-js / index.js View on Github external
matrix: function (numColumns, numRows, start, increment) {
		return new DataFrame({
			columnNames: E.range(1, numColumns)
				.select(function (columnNumber) {
					return columnNumber.toString();
				})
				.toArray(),

			values: function () {
				var rowIndex = 0;
				var nextValue = start;
				var curRow = undefined;

				return {
					moveNext: function () {
						if (rowIndex >= numRows) {
							return false;
						}
						curRow = E.range(0, numColumns)
github data-forge / data-forge-js / src / baseseries.js View on Github external
.selectMany(function (data) {
						var index = data[0];
						var values = data[1];
						return E.range(0, values.length)
							.select(function (_) {
								return index;
							})
							.toArray();
					})
					.toArray();
github data-forge / data-forge-js / index.js View on Github external
moveNext: function () {
						if (rowIndex >= numRows) {
							return false;
						}
						curRow = E.range(0, numColumns)
							.select(function (columnIndex) {
								return nextValue + (columnIndex * increment);
							})
							.toArray();
						nextValue += numColumns * increment;
						++rowIndex;
						return true;
					},

linq

linq.js - LINQ for JavaScript

MIT
Latest version published 6 months ago

Package Health Score

64 / 100
Full package analysis

Popular linq functions