Function
Static Public Summary | ||
public |
AND() |
|
public |
FALSE() |
|
public |
Use with a reducer |
|
public |
NOT() |
|
public |
OR() |
|
public |
TRUE() |
|
public |
accStr() |
|
public |
arrCMP(arr1: [sorted_elements], arr2: [sorted_elements]): integer Compare array, assumes the arry is sorted returns -1, 0, +1 as required by a sotring compare function |
|
public |
concatinate a list of arrays |
|
public |
arrCountVal(list: [type], v: [type]): [type] [arrCountVal description] |
|
public |
THis decorates and array function so that it can have one of two forms 1. |
|
public |
return the difference of two arrays same as arr1 xor arr2 |
|
public |
arrDistinct(arr1: [type], arr2: [type]): [type] arrDistinct description, not array equal |
|
public |
Tests array for equality |
|
public |
arrHash() |
|
public |
arrIntersect(arr1: Array, arr2: Array): Array return the intersection of two arrays |
|
public |
create an array of same values (aVal) where the result has n of those values |
|
public |
arrProd(list: [type]): [type] array cross product in n dimension, where n ils the number of arguments (length of list) Note: this can produce enormous amounts of data for n > 1, for esample n = 2, list[0].length = x ,and list[1].length = y the resultant array contains x*y values, x = 100, y=200 we produce 20,000 values; |
|
public |
array subtraction arr - listToRemove (return an array with all elements of arr this is not in listToRemove) |
|
public |
split an array into n more or less equal length arrays |
|
public |
arrToCol(arr: [type]): [type] [arrToCol description] |
|
public |
return the union of two arrays |
|
public |
zip and array, given an array of columns (each element is a column of values) converts and array of column arrays to and array row arrays |
|
public |
arrayUniq(list: [type]): [type] [description] |
|
public |
asSortedSet(array: [type]): [type] converts an array to sorted set, pure function - does not modify the input |
|
public |
changeNameTo(name: string, sep: string): [oldName, newName] changeNameTo takes a change name description array of two elements containing the old names and the new names e.g oldName=newName 'a name change descriptor' where '=' is the seperator return an array of 2 strings [oldName, newName] |
|
public |
cmpNumOrStrBy(colIX: [type]): function comapre string or number (used to sort frames) |
|
public |
Compare two strings (for sorting) 0 == euqal, -1 a<b, 1 a>b |
|
public |
cmpStrNum compare (number, number), or (number, string-of-number) or (string-of-number, number) (string-of-number, string-of-number) , (string, string) |
|
public |
colName(list: [string], colsNameList1: [string], colsNameList2: [string]): [[string],[string]] colName(['1.DX=DX1', '2.DX=DX2', '1.FX=F1', ...], ['DX','FX',...],['DX',...]) |
|
public |
combineCmp(funcs: ...[type]): [type] combine a set of sorting comparison functions so tht the sort presidence is maintained |
|
public |
coreFrameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame Create a Frame from a string buffer (string reat from a file)
|
|
public |
count the number of occurences of char in the string |
|
public |
createAccesClass(columns: [type]): [type] [createAccesClass description] |
|
public |
converts a line representing comma separated values (CSV) into an array of strings |
|
public |
Takes a array of string lines, representing a list of 'row' strings. |
|
public |
dedupSortedArr(arr: [Array]): [Array] removes all duplicates in a sorted array, pure function - does not modify the input |
|
public |
|
|
public |
|
|
public |
filterDict(aDict: object, listOrFunc: [type]): Object |
|
public |
filter an attar and return the index found |
|
public |
findIndexOf(aSet: [Array], searchElement: [Any]): [Int] find the index of an element is a sorted array representing a set, uses binary search |
|
public |
flatten(arr: [with_inner_arra], level: integer): [type] Flatten an array to a depth of level, for example if level = 1, only flatten at the top level (depath1) |
|
public |
frameCount(aFrame: Frme, colName: string, convName: function): [string, number] [frameCount description] |
|
public |
frameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame Create a Frame from a string buffer (string reat from a file)
|
|
public |
[frameSum description] |
|
public |
frameToString(aFrame: [type]): [type] [frameToString description] |
|
public |
frameWithIndex(aFrame: Frame, indexName: string, atEnd: boolean): Frame [frameWithIndex description] |
|
public |
fromKeyValueList(list: [type]): [type] [fromKeyValueList description] |
|
public |
fromKeyValueListV(list: [type]): [type] [fromKeyValueListV description] |
|
public |
fullInnerJoin(frame1: Frame, frame2: Frame, projectList: [string], joinOn: string, filter: function): Frame
|
|
public |
gbCount(name: [type], newName: [type]): [type] gbCount count elemnts (non empty) in a group, bases on sql group by operation |
|
public |
gbMax max value in a group, see gbMin |
|
public |
gbMean average (mean) value of a group - see gbMin |
|
public |
gbMerge(name: [type], newName: [type], sep: [type]): [type] gbMerge merge the values grouped rows onto a single comma seperated value |
|
public |
gbMergeU(name: [type], newName: [type], sep: [type]): [type] [gbMergeU description] |
|
public |
gbMin minimum elemnts value (non empty) in a group, bases on sql group by operation |
|
public |
gbStdDiv(name: [type], newName: [type]): [type] gbStdDiv standard deviation - see gbMin |
|
public |
gbSum(name: [type], newName: [type]): [type] gbSum sum eelemnts in a group, bases on sql group by operation |
|
public |
gbVal(newName: [type], value: [type]): [type] create a column with constant value |
|
public |
genColIxFunc(aFrame: [type]): [type] [genColIxFunc description] |
|
public |
genFilterFunction(aListOrStringOrEmpty: [string]): [type] create a function that tests for elements in aListOrStringOrEmpty aListOrStringOrEmpty => undefined - allows everything aListOrStringOrEmpty => [... |
|
public |
genObjMapper(obj: [type]): [mapperFunction, [keys]] genObjMapper generates a function to map object to an array this is useful to convert an array of object to the data of a frame |
|
public |
getColIx() |
|
public |
getDict() |
|
public |
getTransform(projectList: [string], cols1: [string], cols2: [string]): Object Takes two column list (or one) and a mapping list and returns a transform function That will create a new row taking columns from each of the lists |
|
public |
groupBy(groupColsOrig: [type], aFrame: [type], accumList: [type]): [type] The frame should already be sorted by the groupBy order, or |
|
public |
groupByToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type] Returns an array of Frames, for each group the name of the Frameis the value of the grouping |
|
public |
groupToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type] [groupToDict description] |
|
public |
hasNoDups(arr: [Array]): [Boolean] checks if sorted array has no dups, pure function - does not modify the input |
|
public |
|
|
public |
indexFrameColumn(aFrame: Frame, colName: String, noNull: boolean, dict: Object): Dict Creates a index for a column (dictionary) |
|
public |
innerJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame innerJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter} |
|
public |
intersect(sortedL: [Array]]): [Array] intersection of a list of sets (sorted arrays) Intersects list sorted array sets (array that issorted and has no duplicates) |
|
public |
intersectL(lsa: [Array]): [Array] intersection of an Array of sets, where each Set is represented as a sorted array of values (no dups) |
|
public |
is the arr/object an array |
|
public |
isEmpty(arrOrObj: [Any]): [Boolean] Check if an array is empty or an object has no attributes |
|
public |
isFunction(fun: any): boolean is obj a function |
|
public |
isSorted(arr: [type]): [boolean] checks if array is sorted, pure function - does not modify the input |
|
public |
is str a string |
|
public |
returns a function that will perform an innet joint test |
|
public |
keys() |
|
public |
Get the last element of an array |
|
public |
leftJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame leftJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter} |
|
public |
|
|
public |
matchIt(res: [type], row1: [type], arr: [type], cmp: [type], tr: [type]): [[row_element] leftJoin on one row from left and arr from right |
|
public |
max(list: [any]): any maximum of a sorted array |
|
public |
Memoize a function (see https://en.wikipedia.org/wiki/Memoization) |
|
public |
create a new array of length n |
|
public |
outerJoin(frame1: [type], frame2: [type], projectList: [type], joinOn: [type], filter: [type]): [type] [outerJoin description] |
|
public |
Create a FUNCTION resturns padded (default is '0') string rep of a number |
|
public |
Same as the |
|
public |
prefixHead(a: string, b: string): string gets the prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be 'asse' |
|
public |
Find the length of the longest prefix of a and b string if a = pre + a1 and b = pre + b1 pre is the longet sting that satisfies the relationship i.e. |
|
public |
prefixTail(a: String, b: String): [string] Gets the non-prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be ['t', 'ss'] |
|
public |
|
|
public |
This is rthe cross product of two arrays, where each arrys is an array of strings the result is and array of length m x n, where m is the length of the first vector and n is the length of the second vector |
|
public |
project() |
|
public |
converts a line representing pipe (|) separated values (PSV) into an array of strings. |
|
public |
range(start: [int32], end: [int32]): [Array] Creates a set (array) of numbers [start ... |
|
public |
|
|
public |
|
|
public |
reord(subListWithNewOrder: [type], fullList: [type]): [type] |
|
public |
Reverses a sort compare function so it sorts in descending order |
|
public |
reverse a string |
|
public |
|
|
public |
|
|
public |
[safeDedup description] |
|
public |
setHash(arrOfInt: [int]): [type] function to take the hash of an array of integers |
|
public |
Set the vale of a key on an object and return the object |
|
public |
setKeyV(obj: [type], key: [type], v: [type]) setKeyV - set object's key (multiple) value, if there is no value argument is present get the value list for the key |
|
public |
shallow() |
|
public |
similarity(sortedA: [Array], sortedB: [Array]): [Array] Show how similar two sets (sorted list) actually are |
|
public |
sortFrameBy(columnNames: [type], aFrame: [type], cmpFn: [type]): [type] create a comparison function for a frame usage sortFrameBy(['+surname', 'givenName', '-age'], aFrame)
|
|
public |
strEq str.substring(strStart,strEnd) === otherStr |
|
public |
Code taken from https://github.com/darkskyapp/string-hash, Too small to be worth is own module. |
|
public |
join an array of strings ignoring empty values |
|
public |
subtract(fromSet: [Array], elementsToRemove: [Array]): [Array] Set subtraction: fromSet - elementsToRemove, assumes both sets are are represented by sorted array, and as per set definition there are no dups |
|
public |
toHTML() |
|
public |
toKeyValueList(obj: [type]): [type] [toKeyValueList description] |
|
public |
toKeyValueListV(obj: [type]): [type] [toKeyValueListV description] |
|
public |
toNumber(str: [type]): [type] Convert a string to a Javascript number, thakes into accont number string with commas (,) and numbers |
|
public |
transpose(frame: [type], pivot: [type]): [type] [transpose description] |
|
public |
trimListElements(arr: [string]): [string] Takes an array of strings and trims all the strings in the array, modifies the input array and returns the same array with the trimed strings |
|
public |
converts a line representing tab separated values (TSV) into an array of strings |
|
public |
unionFrame(frame1: Frame, frame2: Frame, notSorted: boolean): Frame Creates a new frame from the union of the rows of the two frames, similar to s set union. |
|
public |
unionL(lsa: [Array]): [set] Union of a list of sets: assumes both sets are are represented by sorted array, and as per set definition there are no dups |
|
public |
vecAdd(a1: [number], a2: [number]): [number] Add two vectors |
|
public |
xor(array1: [type], array2: [type]): [type] remove all elements that are in both arrays |
|
public |
zipTo() |
|
public |
zipToDict(aListOfPairs: [[string, any]]): [type] |
Static Private Summary | ||
private |
_makeUnique(listOfRows: [column_elements], colIx: [type]): dict |
Static Public
public FLATTEN(res: Array, arr: [type]): [type] source
import {FLATTEN} from 'nurulc.github.io/src/array/flatten.js'
Use with a reducer
Params:
Name | Type | Attribute | Description |
res | Array | ||
arr | [type] |
Return:
[type] |
public arrCMP(arr1: [sorted_elements], arr2: [sorted_elements]): integer source
import arrCMP from 'nurulc.github.io/src/array/arrCMP.js'
Compare array, assumes the arry is sorted returns -1, 0, +1 as required by a sotring compare function
Params:
Name | Type | Attribute | Description |
arr1 | [sorted_elements] | ||
arr2 | [sorted_elements] |
Return:
integer | 1 = less, 0 = equal, +1 = larger |
public arrConcat(arrays: Array): Array source
import arrConcat from 'nurulc.github.io/src/array/arrayutils/arrConcat.js'
concatinate a list of arrays
Params:
Name | Type | Attribute | Description |
arrays | Array | [description] |
public arrCountVal(list: [type], v: [type]): [type] source
import {arrCountVal} from 'nurulc.github.io/src/array/arrayutils/arrCountVal.js'
[arrCountVal description]
Params:
Name | Type | Attribute | Description |
list | [type] | [description] |
|
v | [type] | [description] |
Return:
[type] | [description] |
public arrCurry(functionToDecorate: Function): Function source
import arrCurry from 'nurulc.github.io/src/array/arrayutils/arrCurry.js'
THis decorates and array function so that it can have one of two forms
- arrayFunction(mappingFunction, array)
- arrayFunction(array)
- arrayFunction(mappingFunction) - return a new function that takes just an arra
the originam
performs checks and currying for the functions below
acts on a function of the form arrFunc(transFormFunction, arr)
Params:
Name | Type | Attribute | Description |
functionToDecorate | Function | [description] |
public arrDiff(arr1: Array, arr2: Array): Array source
import arrDiff from 'nurulc.github.io/src/array/arrayutils/arrDiff.js'
return the difference of two arrays same as arr1 xor arr2
public arrDistinct(arr1: [type], arr2: [type]): [type] source
import {arrDistinct} from 'nurulc.github.io/src/array/arrayutils/arrDistinct.js'
arrDistinct description, not array equal
Params:
Name | Type | Attribute | Description |
arr1 | [type] | [description] |
|
arr2 | [type] | [description] |
Return:
[type] | [description] |
public arrEQ(arr1: [elements], arr2: [elements], eqFn: Function): boolean source
import arrEQ from 'nurulc.github.io/src/array/arrEQ.js'
Tests array for equality
Params:
Name | Type | Attribute | Description |
arr1 | [elements] | ||
arr2 | [elements] | ||
eqFn | Function |
public arrIntersect(arr1: Array, arr2: Array): Array source
import arrIntersect from 'nurulc.github.io/src/array/arrayutils/arrIntersect.js'
return the intersection of two arrays
public arrOf(aVal: any, n: int32): Array source
import arrOf from 'nurulc.github.io/src/array/arrayutils/arrOf.js'
create an array of same values (aVal) where the result has n of those values
Params:
Name | Type | Attribute | Description |
aVal | any | a value to duplicate n times |
|
n | int32 | number of occurences in the array |
public arrProd(list: [type]): [type] source
import arrProd from 'nurulc.github.io/src/array/prod.js'
array cross product in n dimension, where n ils the number of arguments (length of list) Note: this can produce enormous amounts of data for n > 1, for esample n = 2, list[0].length = x ,and list[1].length = y the resultant array contains x*y values, x = 100, y=200 we produce 20,000 values;
for diremsion n=3, z = 50
Params:
Name | Type | Attribute | Description |
list | [type] | [description] |
Return:
[type] | [description] |
public arrRemove(arr: Array, listToRemove: Array): Array source
import arrRemove from 'nurulc.github.io/src/array/arrayutils/arrRemove.js'
array subtraction arr - listToRemove (return an array with all elements of arr this is not in listToRemove)
public arrSplit(n: int, arr: Array): Array source
import arrSplit from 'nurulc.github.io/src/array/arrayutils/arrSplit.js'
split an array into n more or less equal length arrays
Params:
Name | Type | Attribute | Description |
n | int | ||
arr | Array |
public arrToCol(arr: [type]): [type] source
import arrToCol from 'nurulc.github.io/src/frame/arrToCol.js'
[arrToCol description]
Params:
Name | Type | Attribute | Description |
arr | [type] | [description] |
Return:
[type] | [description] |
public arrUnion(arr1: Array, arr2: Array): Array source
import arrUnion from 'nurulc.github.io/src/array/arrayutils/arrUnion.js'
return the union of two arrays
public arrZip(arrays: Aarry): Array source
import arrZip from 'nurulc.github.io/src/array/arrayutils/arrZip.js'
zip and array, given an array of columns (each element is a column of values) converts and array of column arrays to and array row arrays
Params:
Name | Type | Attribute | Description |
arrays | Aarry | array of column arrays |
Return:
Array | array of row arrays - [ [arrays[0][0],arrays[1][0], arrays[2][0], ... ], [arrays[0][1],arrays[1][1], arrays[2][1], ... ] |
public arrayUniq(list: [type]): [type] source
import {arrayUniq} from 'nurulc.github.io/src/frame/makeUnique.js'
[description]
Params:
Name | Type | Attribute | Description |
list | [type] | [description] |
Return:
[type] | [description] |
public asSortedSet(array: [type]): [type] source
import asSortedSet from 'nurulc.github.io/src/array/intset/asSortedSet.js'
converts an array to sorted set, pure function - does not modify the input
Params:
Name | Type | Attribute | Description |
array | [type] | the array of (string|number) to sorted and dedup |
Return:
[type] | return a deduped sorted array of (string|number) |
public changeNameTo(name: string, sep: string): [oldName, newName] source
import changeNameTo from 'nurulc.github.io/src/frame/join-utils/changeNameTo.js'
changeNameTo takes a change name description array of two elements containing the old names and the new names e.g oldName=newName 'a name change descriptor' where '=' is the seperator return an array of 2 strings [oldName, newName]
Return:
[oldName, newName] | and ar |
public cmpNumOrStrBy(colIX: [type]): function source
import cmpNumOrStrBy from 'nurulc.github.io/src/utils/sort-helper/cmpNumOrStrBy.js'
comapre string or number (used to sort frames)
Params:
Name | Type | Attribute | Description |
colIX | [type] | column index |
public cmpStr(a: string, b: string): int32 source
import {cmpStr} from 'nurulc.github.io/src/utils/sort-helper/cmpStr.js'
Compare two strings (for sorting) 0 == euqal, -1 a<b, 1 a>b
Return:
int32 | 0 == euqal, -1 = a<b, 1 = a>b |
public cmpStrNum(a: string | number, b: string | number): int32 source
import {cmpStrNum} from 'nurulc.github.io/src/utils/sort-helper/cmpStrNum.js'
cmpStrNum compare (number, number), or (number, string-of-number) or (string-of-number, number) (string-of-number, string-of-number) , (string, string)
Return:
int32 | 0 == euqal, -1 = a<b, 1 = a>b |
public colName(list: [string], colsNameList1: [string], colsNameList2: [string]): [[string],[string]] source
import colName from 'nurulc.github.io/src/frame/join-utils/colName.js'
colName(['1.DX=DX1', '2.DX=DX2', '1.FX=F1', ...], ['DX','FX',...],['DX',...])
returns [ [new-col-list], [ col-mapping]] where <col-mapping> = [<frame number>{0,1}, <old-col-index>, <new-col-index>] result od the code above [ [ 'DX1', 'DX2', 'F1', ...], [ [ 0, 0, 0 ], [ 1, 0, 1 ], [ 0, 1, 2 ], ...] ]
Note:
Params:
Name | Type | Attribute | Description |
list | [string] | resulting column map |
|
colsNameList1 | [string] | [description] |
|
colsNameList2 | [string] | [description] |
Return:
[[string],[string]] | [ [new-col-list], [ col-mapping]] |
public combineCmp(funcs: ...[type]): [type] source
import combineCmp from 'nurulc.github.io/src/utils/sort-helper/combineCmp.js'
combine a set of sorting comparison functions so tht the sort presidence is maintained
Params:
Name | Type | Attribute | Description |
funcs | ...[type] | [description] |
Return:
[type] | [description] |
public coreFrameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame source
import coreFrameFromBuffer from 'nurulc.github.io/src/frame/frame-utils/coreFrameFromBuffer.js'
Create a Frame from a string buffer (string reat from a file)
Lines are seperaed into columns using a 'splitter' supports
- TSV : tab seperated columns - tsvLine
- CSV : comma seperated values - csvLine
- PSV : pipe (|) seperated values popular in healthcare - tsvLine
Default splitter (tsvLine) is tab seperated values
public countCh(data: string, char: char, arr: [int32], start: int32, end: int32): int32 source
import countCh from 'nurulc.github.io/src/string/strutil/countCh.js'
count the number of occurences of char in the string
Params:
Name | Type | Attribute | Description |
data | string | [description] |
|
char | char | [description] |
|
arr | [int32] | optional array to place the index of char in string |
|
start | int32 | optional start start index of the string |
|
end | int32 | optional last index of the string |
Return:
int32 | number of occurences of the char in the string |
public createAccesClass(columns: [type]): [type] source
import {createAccesClass} from 'nurulc.github.io/src/frame/frame_element.js'
[createAccesClass description]
Params:
Name | Type | Attribute | Description |
columns | [type] | [description] |
Return:
[type] | [description] |
public csvLine(line: string): [string] source
import csvLine from 'nurulc.github.io/src/string/csv/csvLine.js'
converts a line representing comma separated values (CSV) into an array of strings
Params:
Name | Type | Attribute | Description |
line | string | string representing a line of CSV data |
Return:
[string] | an array of strings |
public dataSplit(data: [string], splitter: function, fn: function): [string] source
import dataSplit from 'nurulc.github.io/src/string/csv/dataSplit.js'
Takes a array of string lines, representing a list of 'row' strings. and for each row is split into column elements (each a string) using a splitter function.
Return:
[string] | this is the same as buffer.map(fn|Idnetity).map(splitter) |
public dedupSortedArr(arr: [Array]): [Array] source
import dedupSortedArr from 'nurulc.github.io/src/array/intset/dedupSortedArr.js'
removes all duplicates in a sorted array, pure function - does not modify the input
Params:
Name | Type | Attribute | Description |
arr | [Array] | assumes the array is sorted (will throw an exception if the array is not sorted) |
Return:
[Array] | returns a new array with no duplicates |
public dictToZip() source
import {dictToZip} from 'nurulc.github.io/src/array/arrayutils/zipToDict.js'
public dictToZipB() source
import {dictToZipB} from 'nurulc.github.io/src/array/arrayutils/zipToDict.js'
public filterDict(aDict: object, listOrFunc: [type]): Object source
import filterDict from 'nurulc.github.io/src/utils/objutils/filterDict.js'
Params:
Name | Type | Attribute | Description |
aDict | object | ||
listOrFunc | [type] |
public filterIX(fn: Function, arr: [any]): [integre] source
import {filterIX} from 'nurulc.github.io/src/array/arrayutils/filterIX.js'
filter an attar and return the index found
Params:
Name | Type | Attribute | Description |
fn | Function | testing function for the filter |
|
arr | [any] | array of items to filter |
Return:
[integre] | return an array of indexex |
public findIndexOf(aSet: [Array], searchElement: [Any]): [Int] source
import findIndexOf from 'nurulc.github.io/src/array/intset/findIndexOf.js'
find the index of an element is a sorted array representing a set, uses binary search
Params:
Name | Type | Attribute | Description |
aSet | [Array] | Sorted array representing a set |
|
searchElement | [Any] | he item to search for within the array |
Return:
[Int] | The index of the element which defaults to -1 when not found. |
public flatten(arr: [with_inner_arra], level: integer): [type] source
import {flatten} from 'nurulc.github.io/src/array/flatten.js'
Flatten an array to a depth of level, for example if level = 1, only flatten at the top level (depath1)
Params:
Name | Type | Attribute | Description |
arr | [with_inner_arra] | ||
level | integer | depth the given or undefined the flatten to the bottom |
Return:
[type] |
public frameCount(aFrame: Frme, colName: string, convName: function): [string, number] source
import frameCount from 'nurulc.github.io/src/frame/frame-utils/frameCount.js'
[frameCount description]
Return:
[string, number] | a two element array with the name and count [name, count] |
public frameFromBuffer(buffer: string, splitter: function, options: {noConvert: boolen, name: string, Fr: SomeFrameClass}): Frame source
import frameFromBuffer from 'nurulc.github.io/src/frame/frame-utils/frameFromBuffer.js'
Create a Frame from a string buffer (string reat from a file)
Lines are seperaed into columns using a 'splitter' supports
- TSV : tab seperated columns - tsvLine
- CSV : comma seperated values - csvLine
- PSV : pipe (|) seperated values popular in healthcare - tsvLine
Default splitter (tsvLine) is tab seperated values
public frameSum(aFrame: Frme, colName: string, convName: function, convValue: function): [type] source
import frameSum from 'nurulc.github.io/src/frame/frame-utils/frameSum.js'
[frameSum description]
Return:
[type] | [description] |
public frameToString(aFrame: [type]): [type] source
import frameToString from 'nurulc.github.io/src/frame/frame-utils/frameToString.js'
[frameToString description]
Params:
Name | Type | Attribute | Description |
aFrame | [type] | [description] |
Return:
[type] | [description] |
public frameWithIndex(aFrame: Frame, indexName: string, atEnd: boolean): Frame source
import frameWithIndex from 'nurulc.github.io/src/frame/frame-utils/frameWithIndex.js'
[frameWithIndex description]
public fromKeyValueList(list: [type]): [type] source
import fromKeyValueList from 'nurulc.github.io/src/utils/objutils/fromKeyValueList.js'
[fromKeyValueList description]
Params:
Name | Type | Attribute | Description |
list | [type] | [description] |
Return:
[type] | [description] |
public fromKeyValueListV(list: [type]): [type] source
import fromKeyValueListV from 'nurulc.github.io/src/utils/objutils/fromKeyValueListV.js'
[fromKeyValueListV description]
Params:
Name | Type | Attribute | Description |
list | [type] | [description] |
Return:
[type] | [description] |
public fullInnerJoin(frame1: Frame, frame2: Frame, projectList: [string], joinOn: string, filter: function): Frame source
import fullInnerJoin from 'nurulc.github.io/src/frame/join-utils/fullInnerJoin.js'
example of a join
innerJoin(frame1,frame2, [list-of-cols in resulting table], "join-col1==join-col2")
public gbCount(name: [type], newName: [type]): [type] source
import gbCount from 'nurulc.github.io/src/frame/groupby-utils/gbCount.js'
gbCount count elemnts (non empty) in a group, bases on sql group by operation
e.g. 'select state, quater, count(sale_price) as items_sold from annual_sales groupby state, quater'
in frame operation
summary = frame.groupBy(['state', 'quater', gbCount('sale_price', 'items_sold')]);
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
Return:
[type] | [description] |
public gbMax(name: [type], newName: [type], fn: Function): [type] source
import gbMax from 'nurulc.github.io/src/frame/groupby-utils/gbMax.js'
gbMax max value in a group, see gbMin
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
|
fn | Function | [description] |
Return:
[type] | [description] |
public gbMean(name: string, newName: string, fn: function): [type] source
import gbMean from 'nurulc.github.io/src/frame/groupby-utils/gbMean.js'
gbMean average (mean) value of a group - see gbMin
Return:
[type] | [description] |
public gbMerge(name: [type], newName: [type], sep: [type]): [type] source
import gbMerge from 'nurulc.github.io/src/frame/groupby-utils/gbMerge.js'
gbMerge merge the values grouped rows onto a single comma seperated value
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
|
sep | [type] | [description] |
Return:
[type] | [description] |
public gbMergeU(name: [type], newName: [type], sep: [type]): [type] source
import gbMergeU from 'nurulc.github.io/src/frame/groupby-utils/gbMergeU.js'
[gbMergeU description]
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
|
sep | [type] | [description] |
Return:
[type] | [description] |
public gbMin(name: [type], newName: [type], fn: Function): [type] source
import gbMin from 'nurulc.github.io/src/frame/groupby-utils/gbMin.js'
gbMin minimum elemnts value (non empty) in a group, bases on sql group by operation
e.g. 'select state, quater, product_id, min(sale_price) as min_prod_price from annual_sales groupby state, quater'
in frame operation
summary = frame.groupBy(['state', 'quater', 'product_id", gbMin('sale_price', 'min_prod_price')]);
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
|
fn | Function | [description] |
Return:
[type] | [description] |
public gbStdDiv(name: [type], newName: [type]): [type] source
import gbStdDiv from 'nurulc.github.io/src/frame/groupby-utils/gbStdDiv.js'
gbStdDiv standard deviation - see gbMin
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
Return:
[type] | [description] |
public gbSum(name: [type], newName: [type]): [type] source
import gbSum from 'nurulc.github.io/src/frame/groupby-utils/gbSum.js'
gbSum sum eelemnts in a group, bases on sql group by operation
e.g. 'select state, quater, sum(sale_price) as sales from annual_sales groupby state, quater'
in frame operation
summary = frame.groupBy(['state', 'quater', gbSum('sale_price', 'sales')]);
Params:
Name | Type | Attribute | Description |
name | [type] | [description] |
|
newName | [type] | [description] |
Return:
[type] | [description] |
public gbVal(newName: [type], value: [type]): [type] source
import gbVal from 'nurulc.github.io/src/frame/groupby-utils/gbVal.js'
create a column with constant value
Params:
Name | Type | Attribute | Description |
newName | [type] | [description] |
|
value | [type] | [description] |
Return:
[type] | [description] |
public genColIxFunc(aFrame: [type]): [type] source
import genColIxFunc from 'nurulc.github.io/src/frame/genColIxFunc.js'
[genColIxFunc description]
Params:
Name | Type | Attribute | Description |
aFrame | [type] | [description] |
Return:
[type] | [description] |
public genFilterFunction(aListOrStringOrEmpty: [string]): [type] source
import genFilterFunction from 'nurulc.github.io/src/utils/objutils/genFilterFunction.js'
create a function that tests for elements in aListOrStringOrEmpty aListOrStringOrEmpty => undefined - allows everything aListOrStringOrEmpty => [... names ] - allow only the elelemnts in the list aListOrStringOrEmpty => <single string Name> (string) - allow only single name
Params:
Name | Type | Attribute | Description |
aListOrStringOrEmpty | [string] |
Return:
[type] |
public genObjMapper(obj: [type]): [mapperFunction, [keys]] source
import genObjMapper from 'nurulc.github.io/src/utils/objutils/genObjMapper.js'
genObjMapper generates a function to map object to an array this is useful to convert an array of object to the data of a frame
Params:
Name | Type | Attribute | Description |
obj | [type] | [description] |
Return:
[mapperFunction, [keys]] | returns an array first element that function to convert the object to an array, and the secont element is an array of column names |
public getTransform(projectList: [string], cols1: [string], cols2: [string]): Object source
import getTransform from 'nurulc.github.io/src/frame/join-utils/getTransform.js'
Takes two column list (or one) and a mapping list and returns a transform function That will create a new row taking columns from each of the lists
Params:
Name | Type | Attribute | Description |
projectList | [string] | example ['1.DX=DX1', '2.DX=DX2', '1.FX=F1', ...], ['DX','FX',...],['DX',...] |
|
cols1 | [string] | example ['DX','FX',...] |
|
cols2 | [string] | example 'DX',...] |
Return:
Object | return an object of the form {transform, newColumnNames, mapingArray} the mapping array = [ ...[<frame number>{0,1}, <old-col-index>, <new-col-index>]] |
public groupBy(groupColsOrig: [type], aFrame: [type], accumList: [type]): [type] source
import {groupBy} from 'nurulc.github.io/src/frame/groupby.js'
The frame should already be sorted by the groupBy order, or
Params:
Name | Type | Attribute | Description |
groupColsOrig | [type] | [description] |
|
aFrame | [type] | [description] |
|
accumList | [type] | [description] |
Return:
[type] | [description] |
public groupByToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type] source
import groupByToDict from 'nurulc.github.io/src/dict/utils/groupByToDict.js'
Returns an array of Frames, for each group the name of the Frameis the value of the grouping
Params:
Name | Type | Attribute | Description |
aFrame | [type] | [description] |
|
colName | [type] | [description] |
|
cmp | [type] | [description] |
|
mapFn | [type] | [description] |
Return:
[type] | [description] |
public groupToDict(aFrame: [type], colName: [type], cmp: [type], mapFn: [type]): [type] source
import groupToDict from 'nurulc.github.io/src/dict/utils/groupToDict.js'
[groupToDict description]
Params:
Name | Type | Attribute | Description |
aFrame | [type] | [description] |
|
colName | [type] | [description] |
|
cmp | [type] | [description] |
|
mapFn | [type] | [description] |
Return:
[type] | [description] |
public hasNoDups(arr: [Array]): [Boolean] source
import hasNoDups from 'nurulc.github.io/src/array/intset/hasNoDups.js'
checks if sorted array has no dups, pure function - does not modify the input
Params:
Name | Type | Attribute | Description |
arr | [Array] | sorted set of values |
Return:
[Boolean] | true if the sorted array has no diplicated, false otherwise (undefined is not a sorted set) |
public indexFrameColumn(aFrame: Frame, colName: String, noNull: boolean, dict: Object): Dict source
import indexFrameColumn from 'nurulc.github.io/src/frame/join-utils/indexFrameColumn.js'
Creates a index for a column (dictionary)
Return:
Dict | Dict[key] --> array of columns that contain the key in column(colName). Note a row is an array of columns |
public innerJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame source
import {innerJoin} from 'nurulc.github.io/src/frame/join-utils/innerJoin.js'
innerJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter}
Params:
Name | Type | Attribute | Description |
frame1 | Frame | [description] |
|
frame2 | Frame | [description] |
|
projectList | Array<string> | Array of column name mapping example "" |
|
joinOn | String | column name to join on, either "colName" (same name exists on both frame) or "colName1=colName2" (colName1 - column from frame1, colName2 - column from frame2) |
|
filter | function | *optional filter function - filter(row1,row2) |
public intersect(sortedL: [Array]]): [Array] source
import intersect from 'nurulc.github.io/src/array/intset/intersect.js'
intersection of a list of sets (sorted arrays) Intersects list sorted array sets (array that issorted and has no duplicates)
Params:
Name | Type | Attribute | Description |
sortedL | [Array]] | Array of sorted array representing a set (no duplicated) |
Return:
[Array] | sorted array with no duplicates (a set) |
public intersectL(lsa: [Array]): [Array] source
import intersectL from 'nurulc.github.io/src/array/intset/intersectL.js'
intersection of an Array of sets, where each Set is represented as a sorted array of values (no dups)
Params:
Name | Type | Attribute | Description |
lsa | [Array] | Array of sets |
Return:
[Array] | a Sorted array representing the intersection of all the sts |
public isArray(arr: any): boolean source
import isArray from 'nurulc.github.io/src/utils/types/isArray.js'
is the arr/object an array
Params:
Name | Type | Attribute | Description |
arr | any |
public isEmpty(arrOrObj: [Any]): [Boolean] source
import isEmpty from 'nurulc.github.io/src/utils/types/isEmpty.js'
Check if an array is empty or an object has no attributes
Params:
Name | Type | Attribute | Description |
arrOrObj | [Any] |
Return:
[Boolean] | true if empty array or empty object |
public isFunction(fun: any): boolean source
import isFunction from 'nurulc.github.io/src/utils/types/isFunction.js'
is obj a function
Params:
Name | Type | Attribute | Description |
fun | any | is a object that may be a function object |
public isSorted(arr: [type]): [boolean] source
import isSorted from 'nurulc.github.io/src/array/intset/isSorted.js'
checks if array is sorted, pure function - does not modify the input
Params:
Name | Type | Attribute | Description |
arr | [type] | Array of values (string|number) |
Return:
[boolean] | true if the array is sorted, false otherwise (undefined is not a sorted set) |
public isString(str: String): boolean source
import isString from 'nurulc.github.io/src/utils/types/isString.js'
is str a string
Params:
Name | Type | Attribute | Description |
str | String |
public joinOp(frame1: Frame, frame2: Frame, col1: string, col2: string, filter: function): function source
import joinOp from 'nurulc.github.io/src/frame/join-utils/joinOp.js'
returns a function that will perform an innet joint test
public last(arr: [type], defaultV: String): [type] source
import last from 'nurulc.github.io/src/array/arrayutils/last.js'
Get the last element of an array
Params:
Name | Type | Attribute | Description |
arr | [type] | [description] |
|
defaultV | String | [description] |
Return:
[type] | [description] |
public leftJoin(frame1: Frame, frame2: Frame, projectList: Array<string>, joinOn: String, filter: function): Frame source
import {leftJoin} from 'nurulc.github.io/src/frame/join-utils/leftJoin.js'
leftJoin works like an SQL inner join, not quite as flexible, select a as A, b, frame1.x from frame1, frame2 where frame1.colName1 = frame2.colName2 and {filter}
Params:
Name | Type | Attribute | Description |
frame1 | Frame | [description] |
|
frame2 | Frame | [description] |
|
projectList | Array<string> | Array of column name mapping example "" |
|
joinOn | String | column name to join on, either "colName" (same name exists on both frame) or "colName1=colName2" (colName1 - column from frame1, colName2 - column from frame2) |
|
filter | function | *optional filter function - filter(row1,row2) |
public localGroupBy() source
import localGroupBy from 'nurulc.github.io/src/frame/join-utils/localGroupBy.js'
public matchIt(res: [type], row1: [type], arr: [type], cmp: [type], tr: [type]): [[row_element] source
import matchIt from 'nurulc.github.io/src/frame/join-utils/matchIt.js'
leftJoin on one row from left and arr from right
Params:
Name | Type | Attribute | Description |
res | [type] | ||
row1 | [type] | ||
arr | [type] | ||
cmp | [type] | ||
tr | [type] |
Return:
[[row_element] |
public max(list: [any]): any source
import max from 'nurulc.github.io/src/array/intset/max.js'
maximum of a sorted array
Params:
Name | Type | Attribute | Description |
list | [any] |
Return:
any |
public memoize(fn: Function): Function source
import memoize from 'nurulc.github.io/src/utils/objutils/memoize.js'
Memoize a function (see https://en.wikipedia.org/wiki/Memoization)
Params:
Name | Type | Attribute | Description |
fn | Function | function to memoize |
public newArray(n: integer, v: value): Array source
import newArray from 'nurulc.github.io/src/array/arrayutils/newArray.js'
create a new array of length n
Params:
Name | Type | Attribute | Description |
n | integer | [description] |
|
v | value | optional value to initialize the array |
public outerJoin(frame1: [type], frame2: [type], projectList: [type], joinOn: [type], filter: [type]): [type] source
import {outerJoin} from 'nurulc.github.io/src/frame/join-utils/outerJoin.js'
[outerJoin description]
Params:
Name | Type | Attribute | Description |
frame1 | [type] | [description] |
|
frame2 | [type] | [description] |
|
projectList | [type] | [description] |
|
joinOn | [type] | [description] |
|
filter | [type] | [description] |
Return:
[type] | [description] |
public padTo(padLength: number, padChar: char): function source
import padTo from 'nurulc.github.io/src/string/strutil/padTo.js'
Create a FUNCTION resturns padded (default is '0') string rep of a number
usage: padTo(5)(66) => '00066'; or let pad3 = padTo(3,' '); pad3(5) -> ' 5' pad3(45) -> ' 45' pad3(666) -> '666' pad3(76543) -> '76543'
Params:
Name | Type | Attribute | Description |
padLength | number | ||
padChar | char | padding char '0' default |
public pickRaw(list: String): function source
import pickRaw from 'nurulc.github.io/src/utils/objutils/pickRaw.js'
Same as the pick(...)
function withour memoizing
Params:
Name | Type | Attribute | Description |
list | String | String or array of strings |
public prefixHead(a: string, b: string): string source
import prefixHead from 'nurulc.github.io/src/string/strutil/prefixHead.js'
gets the prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be 'asse'
public prefixLen(a: string, b: string): Number source
import prefixLen from 'nurulc.github.io/src/string/strutil/prefixLen.js'
Find the length of the longest prefix of a and b string if a = pre + a1 and b = pre + b1 pre is the longet sting that satisfies the relationship i.e. prefixLen(a1,b1) === 0 returns (pre.length )
public prefixTail(a: String, b: String): [string] source
import prefixTail from 'nurulc.github.io/src/string/strutil/prefixTail.js'
Gets the non-prefix string of 'a' and 'n', for example a = 'asset', b = 'assess', the return will be ['t', 'ss']
Return:
[string] | the non-common parts of a and b, the part after the common prefix |
public prod(s: string | [string], list: [string]): [string] source
import prod from 'nurulc.github.io/src/string/strutil/prod.js'
This is rthe cross product of two arrays, where each arrys is an array of strings the result is and array of length m x n, where m is the length of the first vector and n is the length of the second vector
this is like a full multiplication table where the inner operation (the multiplication) is string concatination. Note if either array is a scalar string it is converted into an array
tring prod out, example prod(['a','b'], ['x1', 'x2']) => [ 'ax1', 'bx1', 'ax2', 'bx2' ]
Params:
Name | Type | Attribute | Description |
s | string | [string] | a string or array of strings |
|
list | [string] | of strings |
Return:
[string] | [description] |
public psvLine(line: string): [string] source
import psvLine from 'nurulc.github.io/src/string/csv/psvLine.js'
converts a line representing pipe (|) separated values (PSV) into an array of strings. This is a commely data representation in USA healthcare
Params:
Name | Type | Attribute | Description |
line | string | string representing a line of PSV data |
Return:
[string] | an array of strings |
public range(start: [int32], end: [int32]): [Array] source
import range from 'nurulc.github.io/src/array/intset/range.js'
Creates a set (array) of numbers [start ... (end-1)]
Params:
Name | Type | Attribute | Description |
start | [int32] | start value |
|
end | [int32] | one mare then the last value in the result array |
Return:
[Array] | [description] |
public redim(arr: [any], n: number): [type] source
import redim from 'nurulc.github.io/src/array/arrayutils/redim.js'
Params:
Name | Type | Attribute | Description |
arr | [any] | ||
n | number |
Return:
[type] |
public renameColumns() source
import renameColumns from 'nurulc.github.io/src/utils/renameColumns.js'
public reord(subListWithNewOrder: [type], fullList: [type]): [type] source
import reord from 'nurulc.github.io/src/array/reord.js'
Params:
Name | Type | Attribute | Description |
subListWithNewOrder | [type] | ||
fullList | [type] |
Return:
[type] |
public revCmp(cmp: function): function source
import revCmp from 'nurulc.github.io/src/utils/sort-helper/revCmp.js'
Reverses a sort compare function so it sorts in descending order
Params:
Name | Type | Attribute | Description |
cmp | function | sort comparison function |
public reverse(s: string): string source
import reverse from 'nurulc.github.io/src/string/strutil/reverse.js'
reverse a string
Params:
Name | Type | Attribute | Description |
s | string | string to reverse |
public reverseProjectList1() source
import {reverseProjectList1} from 'nurulc.github.io/src/frame/join-utils/reverseProjectList1.js'
public reverseProjectList2() source
import {reverseProjectList2} from 'nurulc.github.io/src/frame/join-utils/reverseProjectList1.js'
public safeDedup(list: Array): Array source
import safeDedup from 'nurulc.github.io/src/array/arrayutils/safeDedup.js'
[safeDedup description]
Params:
Name | Type | Attribute | Description |
list | Array | [description] |
public setHash(arrOfInt: [int]): [type] source
import {setHash} from 'nurulc.github.io/src/array/arrayutils/setHash.js'
function to take the hash of an array of integers
Params:
Name | Type | Attribute | Description |
arrOfInt | [int] | array of integers |
Return:
[type] | [description] |
public setKey(obj: object, key: string, v: any): object source
import setKey from 'nurulc.github.io/src/utils/objutils/setKey.js'
Set the vale of a key on an object and return the object
obj[key] = v
in Javascript the expression returns the javle of v rather than obj
setKey(Obj, 'someKey', aVal)
returns obj
public setKeyV(obj: [type], key: [type], v: [type]) source
import setKeyV from 'nurulc.github.io/src/utils/objutils/setKeyV.js'
setKeyV - set object's key (multiple) value, if there is no value argument is present get the value list for the key
Params:
Name | Type | Attribute | Description |
obj | [type] | [description] |
|
key | [type] | [description] |
|
v | [type] | [description] |
public similarity(sortedA: [Array], sortedB: [Array]): [Array] source
import similarity from 'nurulc.github.io/src/array/intset/similarity.js'
Show how similar two sets (sorted list) actually are
Params:
Name | Type | Attribute | Description |
sortedA | [Array] | [description] |
|
sortedB | [Array] | [description] |
Return:
[Array] | where the array contains[same_count, different_count] |
public sortFrameBy(columnNames: [type], aFrame: [type], cmpFn: [type]): [type] source
import sortFrameBy from 'nurulc.github.io/src/frame/sortFrame.js'
create a comparison function for a frame usage sortFrameBy(['+surname', 'givenName', '-age'], aFrame)
- == ascending
- == descending
Params:
Name | Type | Attribute | Description |
columnNames | [type] | [description] |
|
aFrame | [type] | [description] |
|
cmpFn | [type] | [description] |
Return:
[type] | [description] |
public strEq(str: string, strStart: int32, strEnd: int32, otherStr: string): boolean source
import strEq from 'nurulc.github.io/src/string/strdict/strEq.js'
strEq str.substring(strStart,strEnd) === otherStr
public strHash(str: string, start: int32, end: int32): int32 source
import strHash from 'nurulc.github.io/src/string/strdict/strHash.js'
Code taken from https://github.com/darkskyapp/string-hash, Too small to be worth is own module.
Params:
Name | Type | Attribute | Description |
str | string | The string to hash (isf str is not a string make it into a string) |
|
start | int32 | start pos in the string |
|
end | int32 | The end position of thestring |
Return:
int32 | The hash value |
public strJoin(arrOfStrings: [String], sep: String): String source
import strJoin from 'nurulc.github.io/src/string/strutil/strJoin.js'
join an array of strings ignoring empty values
Params:
Name | Type | Attribute | Description |
arrOfStrings | [String] | array of strings |
|
sep | String | seperator string |
public subtract(fromSet: [Array], elementsToRemove: [Array]): [Array] source
import subtract from 'nurulc.github.io/src/array/intset/subtract.js'
Set subtraction: fromSet - elementsToRemove, assumes both sets are are represented by sorted array, and as per set definition there are no dups
Params:
Name | Type | Attribute | Description |
fromSet | [Array] | array - array(set) of sorted elements (ascending order) and no duplicated |
|
elementsToRemove | [Array] | array(set) - array of sorted elements (ascending order) and no duplicated |
Return:
[Array] | a new set, where (∀ x ∈ fromSet), then (x ∈ result), if and only if (x ∉ elementsToRemove). |
public toKeyValueList(obj: [type]): [type] source
import toKeyValueList from 'nurulc.github.io/src/utils/objutils/toKeyValueList.js'
[toKeyValueList description]
Params:
Name | Type | Attribute | Description |
obj | [type] | [description] |
Return:
[type] | [description] |
public toKeyValueListV(obj: [type]): [type] source
import toKeyValueListV from 'nurulc.github.io/src/utils/objutils/toKeyValueListV.js'
[toKeyValueListV description]
Params:
Name | Type | Attribute | Description |
obj | [type] | [description] |
Return:
[type] | [description] |
public toNumber(str: [type]): [type] source
import {toNumber} from 'nurulc.github.io/src/utils/sort-helper/toNumber.js'
Convert a string to a Javascript number, thakes into accont number string with commas (,) and numbers
Params:
Name | Type | Attribute | Description |
str | [type] | [description] |
Return:
[type] | [description] |
public transpose(frame: [type], pivot: [type]): [type] source
import transpose from 'nurulc.github.io/src/frame/frame-utils/transpose.js'
[transpose description]
Params:
Name | Type | Attribute | Description |
frame | [type] | [description] |
|
pivot | [type] | [description] |
Return:
[type] | [description] |
public trimListElements(arr: [string]): [string] source
import trimListElements from 'nurulc.github.io/src/string/csv/trimListElements.js'
Takes an array of strings and trims all the strings in the array, modifies the input array and returns the same array with the trimed strings
Params:
Name | Type | Attribute | Description |
arr | [string] | array of strings |
Return:
[string] | returns the same array with the stings trimmed |
public tsvLine(line: string): [string] source
import tsvLine from 'nurulc.github.io/src/string/csv/tsvLine.js'
converts a line representing tab separated values (TSV) into an array of strings
Params:
Name | Type | Attribute | Description |
line | string | string representing a line of TSV data |
Return:
[string] | an array of strings |
public unionFrame(frame1: Frame, frame2: Frame, notSorted: boolean): Frame source
import unionFrame from 'nurulc.github.io/src/frame/frame-utils/unionFrame.js'
Creates a new frame from the union of the rows of the two frames, similar to s set union. There are no duplicate rows in the result. This is anologous to the SQL union operation assumes the frames are sorted, if notSorted is true, then the frames are sorted first;
- the frames must have the same columns names
- the sorting is done in columns order
- The original frames are not modified
public unionL(lsa: [Array]): [set] source
import unionL from 'nurulc.github.io/src/array/intset/unionL.js'
Union of a list of sets: assumes both sets are are represented by sorted array, and as per set definition there are no dups
Params:
Name | Type | Attribute | Description |
lsa | [Array] | array[ array{set}... ] - array{set} of sorted elements (ascending order) and no duplicated |
Return:
[set] | a new set, where result = lsa[0] ∪ lsa[1] ∪ ... |
public vecAdd(a1: [number], a2: [number]): [number] source
import vecAdd from 'nurulc.github.io/src/array/arrayutils/vecAdd.js'
Add two vectors
Params:
Name | Type | Attribute | Description |
a1 | [number] | ||
a2 | [number] |
Return:
[number] |
public xor(array1: [type], array2: [type]): [type] source
import xor from 'nurulc.github.io/src/array/arrayutils/xor.js'
remove all elements that are in both arrays
Params:
Name | Type | Attribute | Description |
array1 | [type] | ||
array2 | [type] |
Return:
[type] |
public zipToDict(aListOfPairs: [[string, any]]): [type] source
import {zipToDict} from 'nurulc.github.io/src/array/arrayutils/zipToDict.js'
Params:
Name | Type | Attribute | Description |
aListOfPairs | [[string, any]] | list of key value pairs |
Return:
[type] |
Static Private
private _makeUnique(listOfRows: [column_elements], colIx: [type]): dict source
import {_makeUnique} from 'nurulc.github.io/src/frame/makeUnique.js'
Params:
Name | Type | Attribute | Description |
listOfRows | [column_elements] | ||
colIx | [type] | The column to make unique |
Return:
dict | returns an object representing mapping of unique values where key and value are the same |