[R] 'matrix' returns integer instead of decimal

Thomas Lumley tlumley at u.washington.edu
Mon Jan 21 04:13:29 CET 2008

On Sun, 20 Jan 2008, Brant Inman wrote:

> Note the problems in rows 15, 21, 37 and 43.  They should read [0.5, 45.5],
> [14.5, 21.5], etc...  The matrix function seems to be rounding the second
> column up to the next integer.  Why would this occur?  Can I do something to
> prevent this?
> I would very much appreciate any comments.

I don't see this (though I'm not on Windows). My first guess is that the rounding happens in print() rather than in matrix() -- if you print just the [15,2] entry of the matrix is it 45.5 or 46? Is it == to 45.5 or 46?


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list