Skip to content
Prev 343092 / 398506 Next

populating matrix with binary variable after matching data from data frame

Hi.
Thank you for your help.
yes, thats exactly right - but the 1211x1211 matrix has some
row/column elements that may not be present in x1.
Is that the reason I get this error?

My matrix row names and column names are identical. I changed the
order in my dput code for representational purpose so that they can
have 1 for conveying question easily.

Thanks


    A  B C D E
A
B
C
D
+   x[x1$V1[i], x1$V2[i]] <- 1;
+ }
Error in `[<-`(`*tmp*`, x1[i, ]$V1, x1[i, ]$V2, value = 1) :
  subscript out of bounds







On Wed, Aug 13, 2014 at 8:28 AM, John McKown
<john.archie.mckown at gmail.com> wrote: