<commit_before>﻿(function(global) {
	// store for release the varible when confliction
	var _R = global.R,
		R = {};

	// referer https://gist.github.com/caseyjustus/1166258
	function median(values) { 
	    values.sort(function(a,b) {
	    	return a - b;
	    });
	 
	    var half = Math.floor(values.length/2);
	 
	    if(values.length % 2) {
	        return values[half];
	    } else {
	        return (values[half-1] + values[half]) / 2.0;
	    }
	}
	R.median = median;



	// expose to global namespace
	global.R = R;

})(window);



<commit_msg>function | mean min max<commit_after>﻿(function(global) {
	// store for release the varible when confliction
	var _R = global.R,
		R = {};

	// referer https://gist.github.com/caseyjustus/1166258
	function median(values) { 
	    values.sort(function(a,b) {
	    	return a - b;
	    });
	 
	    var half = Math.floor(values.length/2);
	 
	    if(values.length % 2) {
	        return values[half];
	    } else {
	        return (values[half-1] + values[half]) / 2.0;
	    }
	}
	R.median = median;


	// referer http://javascript.about.com/library/blaravg.htm
	function mean(values) {
		var avg = 0,
			count = 0,
			length = values.length;

		for (var i = 0; i < length; i++) {
			var e = +values[i];
			if(!e && values[i] !== 0 && values[i] !== '0') {
				e--;
			}

			if (values[i] == e) {
				avg += e; 
				count++;
			}
		}
		
		return avg/count;
	}
	R.mean = mean;
	//	use case
	//	var ary = [5,8,2,4,11,7,3];
	//	var average = ary.avg();


	function min(values) {
		return Math.min.apply(null, values);
	}
	R.min = min;

	function max(values) {
		return Math.max.apply(null, values);
	}
	R.max = average;

	// expose to global namespace
	global.R = R;

})(window);




{'fraction_non_alphanumeric': 0.169953596287703, 'fraction_numerical': 0.021461716937354988, 'mean_word_length': 2.298279158699809, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150792', 'n_tokens_mistral': 748, 'n_tokens_neox': 645, 'n_words': 144}