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

peter dalgaard pdalgd at gmail.com
Tue Aug 10 11:16:32 CEST 2010


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 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list