Mode value from a array of data

I currently trying to obtain mode from a array of data that feed by a sensor. I tried to use the Average Library Average example but unable to compile . I received the following error :

Arduino: 1.6.3 (Windows 7), Board: “Arduino Mega ADK”

Build options changed, rebuilding all

saas.ino: In function ‘void loop()’:

saas.ino:21:26: error: ‘mean’ was not declared in this scope

saas.ino:23:26: error: ‘mode’ was not declared in this scope

saas.ino:25:29: error: ‘maximum’ was not declared in this scope

saas.ino:27:29: error: ‘minimum’ was not declared in this scope

saas.ino:29:28: error: ‘stddev’ was not declared in this scope

Error compiling.

Please help me , I tried so many method to solve this problem. The library is installed properly .

#include <Average.h>

#define CNT 600
int d[CNT];

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  int i;

  for(i=0; i<CNT; i++)
  {
    d[i] = random(500);
  }  

  Serial.print("Mean: ");
  Serial.print(mean(d,CNT),DEC);
  Serial.print(" Mode: ");
  Serial.print(mode(d,CNT),DEC);
  Serial.print(" Max: ");
  Serial.print(maximum(d,CNT),DEC);
  Serial.print(" Min: ");
  Serial.print(minimum(d,CNT),DEC);
  Serial.print(" Standard deviation: ");
  Serial.print(stddev(d,CNT),4);
  Serial.println("");
  Serial.println("");

  delay(5000);
}

The only way to know if the library is installed "properly" is to compile a sketch which uses the library. Since your test sketch won't compile, then I would suggest that it's not installed properly.

What do you call 'proper'? Where is it installed and what is the exact name of the folder it's installed in? Note that it may be case-sensitive, so the library folder should be called "Average" with a capital-A. Any time you download something from Github, it usually makes the name something like "Average-master" and you have to remove the "-master".

Dear Sir , I tried to compile the example that comes with the zip file . I could compile and run it .

 #include <Average.h>

// Reserve space for 10 entries in the average bucket.
// Change the type between < and > to change the entire way the library works.
Average<float> ave(10);

void setup() {
	Serial.begin(9600);
}

void loop() {
	// Add a new random value to the bucket
	ave.push(rand());

	// Display the current data set
	for (int i = 0; i < 10; i++) {
		Serial.print(ave.get(i));
		Serial.print(" ");
	}
	Serial.println();

	// And show some interesting results.
	Serial.print("Mean:   "); Serial.println(ave.mean());
	Serial.print("Mode:   "); Serial.println(ave.mode());
	Serial.print("Max:    "); Serial.println(ave.maximum());
	Serial.print("Min:    "); Serial.println(ave.minimum());
	Serial.print("StdDev: "); Serial.println(ave.stddev());
	delay(1000);
}

I was able to compile the example that came with the library - however when I run it and view the serial monitor the results do not seam to calculate correctly.

E.g. in the array of all 0.00 data all the results are 16807, except for standard deviation. The next data set that contains 9 x 0.00 values and one 15089.00 none of the calculations are correct.

Any solutions? See serial output:

0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Mean: 16807.00
Mode: 16807.00
Max: 16807.00
Min: 16807.00
StdDev: 0.00
0.00 15089.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Mean: 15948.00
Mode: 16807.00
Max: 16807.00
Min: 15089.00
StdDev: 859.00
0.00 11481.00 15089.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Mean: 14459.00
Mode: 16807.00
Max: 16807.00
Min: 11481.00
StdDev: 2219.50