S-Plus is really flexible with vector and matrix operations. Here's an example:
> retmat = matrix(c(1, 0.002, 0.042, 0.22, 1, 0.052, 0.041, 0.02, 1, 0.034, 0.742, 0.245, 1, 0.234, 0.042, 0.223, 1, 0.23, 0.092, 0.292, 2, 0.023, 0.002, 0.22, 2, 0.094, 0.023, 0.928, 2, 0.95, 0.293, 0.032, 2, 0.908...