[R] 'matrix' returns integer instead of decimal
Henrik Bengtsson
hb at stat.berkeley.edu
Mon Jan 21 04:24:03 CET 2008
Check your getOption("digits"). Default is typically 7. Either you
or a package/function sets it to a small value. You get that
**output** with options(digits=n) where n=1,2,3.
/Henrik
On Jan 20, 2008 7:13 PM, Thomas Lumley <tlumley at u.washington.edu> wrote:
> 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
>
>
> Thomas Lumley Assoc. Professor, Biostatistics
> tlumley at u.washington.edu University of Washington, Seattle
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list