Dear R list,
I have discovered a seemingly peculiar feature when using a matrix to
index itself (yes, this is strange code, which I have now modified to
be more reasonable).
#this makes sense
s - matrix(1:3,nrow=1)
s[s]#all three elements are shown
#but when I try
s -
William -
An interesting feature of matrix indexing in R is that
if you provide a two column matrix as a subscript, you are
refering to the elements whose indices are in the rows
of the matrix. This is extremely handy for converting
tables to matrices:
m =
2 matches
Mail list logo