In reply to Rick Wicklin.

If you could be certain that the matrix does not contain any missing values, then the SPARSE function could be used (even when zeros are present) as follows:
.
S = sparse( choose(R, R, .) );
S = choose(S, S, 0);
.
Not intuitive I admit!