I'm trying to find the variance of various outputs in a matrix:

for(l in 2:vl){
  for(o in 1:(l-1)){

    # Make sure the inputs are for the matrix "m"
    input3=rownames(v)[o]
    input4=colnames(v)[l]

    r=t[(t$Rec1==input3 & t$Rec2==input4),output]

    if(length(r)==0){
      r=t[(t$Rec1==input4 & t$Rec2==input3),output]
    }

    v[l,o]=var(q,na.rm=TRUE)
    v[o,l]=var(q,na.rm=TRUE)
    v[l,l]=var(q,na.rm=TRUE)

  }
}

Each output will yield multiple results, since each input length varies.
I'm not sure if this is the right way to go about finding the variance of
each pair, but this is what I've done.
The main issue I have with this now is that the results in every box in the
matrix yield the same exact number, even though that most likely shouldn't
happen.

The question is: "How would I find the variance of each pair of inputs?"

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to