Needs average of four columns of fields but ignore zeros
I have a form with four individual columns that need an average calculated, but with the zeros ignored. Below is what it looks like. The fields in each column are either E. R2. R3. R4., wish sequential numbers after each dot. The averages need to calculate in the DLA row. (Keep in mind this page two, there are numbers on the other, bringing up the sum at the bottom).

I've come across different codes but I am understanding they have to be a document level. How do I do that when I need four different averages?
This is what I have found. Document-level script:
function calcAverage(aFields, bIgnoreBlanks, bIgnoreZeros) {
var total = 0;
var n = 0;
for (var i in aFields) {
var f = this.getField(aFields);
if (f==null) {
console.println("Error! Can't locate a field called: " + aFields);
continue;
}
if (f.valueAsString=="" && bIgnoreBlank) continue;
var v = Number(f.valueAsString);
if (isNaN(v)) continue;
if (v==0 && bIgnoreZeros) continue;
total+=v;
n++;
}
if (n==0) event.value = "";
else event.value = total/n;
}
Then for the DLA boxes, I am guessing I am supposed to run this script, but I am not sure how to write my form field names. For the first column, would it only "R1"?
calcAverage(["Knowledge1", "Knowledge2", "Knowledge3", "Knowledge4", "Knowledge5", "Knowledge6"], true, true);
So, questions - are these the correct scripts I need to be using and how do I make it work for my document? I have basic knowledge of JS. I really just need someone to tell me what to put and where to put it, and what I need to replace with my field names. Please and thank you so much!
