I have an array, pictured below, which contains a number of values which I would like to do some calculations on a then push to a separate array.
This is is an example of the array and data I an working with:
I would like to push this data into an array called formatted, This array must contain the following information:
name - taken from the name form the original array
min - the lowest value from the original array
max - the largest value from the original array
Q1 - this is the lower quartile which is calculated from the original array by adding the p30 and p40 values and dividing by 2
Q4 - this is is the upper quartile value which is calculated by adding the p70 and p80 values together and dividing by 2
median - this is calculated by adding the p50 and p60 values together and dividing by 2
This is an example of how I tried to solve this but as seen below I had a error on every value:
var formated = [];
for(var i=0; i < final.length; i++) {
formated.push({
name: final[i].name,
min: final[i][0],
max: final[i].length -1,
Q1: (final[1] + final[2] / 2),
Q2: (final[5] + final[6] / 2),
meidan: (final[3] + final[4] / 2)
});
}

