Skip to content
Prev 285430 / 398502 Next

built a lower triangular matrix from dataframe

Perhaps ignore the lower-triangularity for a moment and do something like this:

x <- matrix(NA, ncol = max(j), nrow = max(i))
x[i, j] <- k

Your code will be clearer if you use with() rather than df$i constructs.

Hope this helps,

Michael

On Wed, Feb 15, 2012 at 11:47 AM, nymphita
<sandrablazquezcabrera at gmail.com> wrote: