[R] Identifying integers (as opposed to real #s) in matrix

2010-08-10 Thread David Katz
Is there a way to identify (for subsequent replacement) which rows in a matrix are comprised entirely of *integers*? I have a large set of *nx3 *matrices where each row either consists of a set of 3 integers or a set of 3 real numbers. A given matrix might looks something like this:

Re: [R] Identifying integers (as opposed to real #s) in matrix

2010-08-10 Thread Romain Francois
Le 10/08/10 10:05, David Katz a écrit : Is there a way to identify (for subsequent replacement) which rows in a matrix are comprised entirely of *integers*? I have a large set of *nx3 *matrices where each row either consists of a set of 3 integers or a set of 3 real numbers. A given matrix

Re: [R] Identifying integers (as opposed to real #s) in matrix

2010-08-10 Thread peter dalgaard
On Aug 10, 2010, at 10:13 AM, Romain Francois wrote: rowSums( x == round(x) ) == ncol(x) [1] TRUE FALSE TRUE FALSE For later readability, I think I'd prefer apply(x==round(x), 1, all) -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000