Hello,
I am trying to create a matrix that generates an output from 2 inputs. The
problem I have is that I'm assigning a large set of data to various
categories (that are used for the matrix). This technically means that I
will have multiple output values for each unique set of inputs--I want to
average the values of the output. How would I do so?
n=length(b$largedataset)
for(j in 2:n){
for(i in 1:(j-1)){
input1=rownames(m)[i]
input2=rownames(m)[j]
q=t[(t$category1==input1 & t$category2==input2),output]
if(length(q)==0){
q=t[(t$category1==input2 & t$category2==input1),output]
}
m[i,j]=q
m[j,i]=q
}
}
I've only got up to here and don't know how to continue.
[[alternative HTML version deleted]]