private String printAsCSVWithStats(int statsInterval)
	{
		if(statsInterval > 0)
		{
			String results = ",";

			ArrayList<String> row;

			int startIndex = 0;
			int statsCounter = 0;

			for(int r = 0; r < this.ROWS; r++)
			{
				row = this.getRow(r);
				for(String s : row)
					results = results + s + ",";

						results = results + "\n,";

						if(statsCounter+1 == statsInterval)
						{
							statsCounter = -1;

							results = results.substring(0,results.length()-1);// trim last comma
							String sumRow = "SUM,";
							String avgRow = "AVG,";
							String minRow = "MIN,";
							String maxRow = "MAX,";
							String varRow = "VAR,";
							String stdevRow = "STDEV,";

							for(int c = 0; c < this.COLUMNS;c++)
							{
								sumRow = sumRow + this.sumColumn(c, startIndex, startIndex+statsInterval) + ",";
								avgRow = avgRow + this.avgColumn(c, startIndex, startIndex+statsInterval) + ",";
								minRow = minRow + this.minInColumn(c, startIndex, startIndex+statsInterval) + ",";
								maxRow = maxRow + this.maxInColumn(c, startIndex, startIndex+statsInterval) + ",";
								varRow = varRow + this.varInColumn(c, startIndex, startIndex+statsInterval) + ",";
								stdevRow = stdevRow + this.stdevInColumn(c, startIndex, startIndex+statsInterval) + ",";
							}

							sumRow = sumRow + "\n";
							avgRow = avgRow + "\n";
							minRow = minRow + "\n";
							maxRow = maxRow + "\n";
							varRow = varRow + "\n";
							stdevRow = stdevRow + "\n";

							results = results + sumRow;
							results = results + avgRow;
							results = results + minRow;
							results = results + maxRow;
							results = results + varRow;
							results = results + stdevRow;

							results = results + this.getSpacerRow(this.COLUMNS+1)+",";
							startIndex = r+1;
						}

						statsCounter++;
			}

			// trim trailing newline
			results = results.substring(0,results.length()-1);
			return results;
		}
		else
			return this.printAsCSV();

	}