jsdataframe.js
function combineArrays(array1, array2, naValue, func) {
  var skipMissing = true;
  if (isUndefined(func)) {
    func = naValue;
    skipMissing = false;
  }

  var arr1Len = array1.length;
  var arr2Len = array2.length;
  var outputLen = validateArrayLengths(arr1Len, arr2Len);
  var isSingleton1 = (arr1Len === 1);
  var isSingleton2 = (arr2Len === 1);

  var result = allocArray(outputLen);
  for (var i = 0; i < outputLen; i++) {
    var val1 = isSingleton1 ? array1[0] : array1[i];
    var val2 = isSingleton2 ? array2[0] : array2[i];
    if (skipMissing && (isMissing(val1) || isMissing(val2))) {
      result[i] = naValue;
    } else {
      result[i] = func(val1, val2);
    }
  }
  return result;
}
function combineArrays(array1, array2, naValue, func) {
  var skipMissing = true;
  if (isUndefined(func)) {
    func = naValue;
    skipMissing = false;
  }

  var arr1Len = array1.length;
  var arr2Len = array2.length;
  var outputLen = validateArrayLengths(arr1Len, arr2Len);
  var isSingleton1 = (arr1Len === 1);
  var isSingleton2 = (arr2Len === 1);

  var result = allocArray(outputLen);
  for (var i = 0; i < outputLen; i++) {
    var val1 = isSingleton1 ? array1[0] : array1[i];
    var val2 = isSingleton2 ? array2[0] : array2[i];
    if (skipMissing && (isMissing(val1) || isMissing(val2))) {
      result[i] = naValue;
    } else {
      result[i] = func(val1, val2);
    }
  }
  return result;
}
function combineArrays ( array1 , array2 , naValue , func ) { var skipMissing = true ; if ( isUndefined ( func ) ) { func = naValue ; skipMissing = false ; } var arr1Len = array1 . length ; var arr2Len = array2 . length ; var outputLen = validateArrayLengths ( arr1Len , arr2Len ) ; var isSingleton1 = ( arr1Len === 1 ) ; var isSingleton2 = ( arr2Len === 1 ) ; var result = allocArray ( outputLen ) ; for ( var i = 0 ; i < outputLen ; i ++ ) { var val1 = isSingleton1 ? array1 [ 0 ] : array1 [ i ] ; var val2 = isSingleton2 ? array2 [ 0 ] : array2 [ i ] ; if ( skipMissing && ( isMissing ( val1 ) || isMissing ( val2 ) ) ) { result [ i ] = naValue ; } else { result [ i ] = func ( val1 , val2 ) ; } } return result ; }
Applies the given 'func' to each pair of elements from the 2 given arrays and yields a new array with the results.  The lengths of the input arrays must either be identical or one of the arrays must have length 1, in which case that single value will be repeated for the length of the other array. The 'naValue' argument is optional.  If present, any pair of elements with either value missing will immediately result in 'naValue' without evaluating 'func'.  If 'naValue' isn't specified, 'func' will be applied to all pairs of elements.
Applies the given func to each pair of elements from the 2 given arrays and yields a new array with the results . The lengths of the input arrays must either be identical or one of the arrays must have length 1 in which case that single value will be repeated for the length of the other array . The naValue argument is optional . If present any pair of elements with either value missing will immediately result in naValue without evaluating func . If naValue isn t specified func will be applied to all pairs of elements .