Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-31 Thread Marc Schwartz
On Tue, 2005-05-31 at 11:11 -0400, Duncan Murdoch wrote: > Marc Schwartz wrote: > > > Final note to Henrik: Note that the IEEE 754 rounding standard as > > implemented in R results in: > > > > > >>round(18.15, 1) > > > > [1] 18.1 > > > >>formatC(18.15, format = "f", digits = 1) > > > > [1] "1

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-31 Thread Gabor Grothendieck
On 5/31/05, Marc Schwartz <[EMAIL PROTECTED]> wrote: > On Mon, 2005-05-30 at 23:53 -0400, Gabor Grothendieck wrote: > > On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > Gabor Grothendieck wrote: > > > > On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > > > > > >>Henrik Andersso

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-31 Thread Duncan Murdoch
Marc Schwartz wrote: Final note to Henrik: Note that the IEEE 754 rounding standard as implemented in R results in: round(18.15, 1) [1] 18.1 formatC(18.15, format = "f", digits = 1) [1] "18.1" sprintf("%5.1f", 18.15) [1] " 18.1" This is because the rounding method implemented is th

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-31 Thread Marc Schwartz
On Mon, 2005-05-30 at 23:53 -0400, Gabor Grothendieck wrote: > On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > Gabor Grothendieck wrote: > > > On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > > > >>Henrik Andersson wrote: > > >> > > >>>I have tried to get signif, round and form

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-30 Thread Gabor Grothendieck
On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > Gabor Grothendieck wrote: > > On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > > >>Henrik Andersson wrote: > >> > >>>I have tried to get signif, round and format to display numbers like > >>>these consistently in a table, using e.g. s

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-30 Thread Duncan Murdoch
Gabor Grothendieck wrote: On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: Henrik Andersson wrote: I have tried to get signif, round and format to display numbers like these consistently in a table, using e.g. signif(x,digits=3) 17.01 18.15 I want 17.0 18.2 Not 17 18.2 Why is the

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-30 Thread Gabor Grothendieck
On 5/30/05, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > Henrik Andersson wrote: > > I have tried to get signif, round and format to display numbers like > > these consistently in a table, using e.g. signif(x,digits=3) > > > > 17.01 > > 18.15 > > > > I want > > > > 17.0 > > 18.2 > > > > Not > > > >

Re: [R] Formatting numbers with a limited amount of digits consistently

2005-05-30 Thread Duncan Murdoch
Henrik Andersson wrote: I have tried to get signif, round and format to display numbers like these consistently in a table, using e.g. signif(x,digits=3) 17.01 18.15 I want 17.0 18.2 Not 17 18.2 Why is the last digit stripped off in the case when it is zero! signif() changes the value;

[R] Formatting numbers with a limited amount of digits consistently

2005-05-30 Thread Henrik Andersson
I have tried to get signif, round and format to display numbers like these consistently in a table, using e.g. signif(x,digits=3) 17.01 18.15 I want 17.0 18.2 Not 17 18.2 Why is the last digit stripped off in the case when it is zero! Is this a "feature" of R or did I miss something? -