0

I have a matrix with column 1 containing several identical numerical values. The corresponding row values, however, are all different.

I have illustrated the situation in the picture below.

enter image description here

The red circles highlight one of the groups that have same column-value. I need the average of the 'MSE' for the groups defined by having same values of 'lambda'. In the above example, one of the averages I am looking for would be (0.9769541 + 0.9902620 + 1.0008839 + 1.0108471 + 0.9981030 + 0.9858211) / 6.

Heroka
  • 12,889
  • 1
  • 28
  • 38
AfBM
  • 13
  • 3
  • Anything you already tried? SO is not a code-writing service. – Heroka Jan 11 '16 at 15:35
  • Well, I did try the following (call the matrix A) A <- as.data.frame(A) A[A$lambda == 'value of lambda',] but it returns <0 rows> – AfBM Jan 11 '16 at 15:42
  • One option: Try `?rowsum` and use `?tapply` or similar for the denominator. – Frank Jan 11 '16 at 15:45

0 Answers0