arquero
Version:
Query processing and transformation of array-backed data tables.
12 lines (11 loc) • 435 B
JavaScript
/**
* Generate a table expression that computes the number of rows
* corresponding to a given fraction for each group. The resulting
* string can be used as part of the input to the sample verb.
* @param {number} fraction The fractional value.
* @return {string} A table expression string for computing row counts.
* @example frac(0.5)
*/
export function frac(fraction) {
return `() => op.round(${+fraction} * op.count())`;
}