Hi

I have a two-column integer matrix like this:


R> jj

      [,1] [,2]
 [1,]   -1    1
 [2,]   -2    2
 [3,]   -7    6
 [4,]   -8    7
 [5,]   -6    5
 [6,]   -9    8
 [7,]   -5    4
 [8,]    3   -3
 [9,]  -10    9
[10,]   -4    3

I want a diagnostic that detects whether a row is a multiple of
the first row or not.  In this case, this would be rows 1,2, and 8.

How to do this nicely?  Sometimes the first row has a zero, so the
method would have to work on

     [,1] [,2]
[1,]    0    1
[2,]    1    1
[3,]    0    8
[4,]    0   -4
[5,]    0    0
[6,]    4    0
>

in which case rows 1,3,4,5 are multiples.  It'd be nice to have
a solution that works for any number of columns.

--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
 tel  023-8059-7743

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to