Re: [R] Printing 2 digits after decimal point [SOLVED]

2010-02-15 Thread T . Wunder
Hi, I'm sorry, I've found the right answer: x - 0 formatC(x,digits=2, format=f) [1] 0.00 The above worked perfectly! Thanks Best wishes ;) Tom Quoting twun...@ix.urz.uni-heidelberg.de: Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g. x -

[R] Printing 2 digits after decimal point

2010-02-15 Thread T . Wunder
Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g. x - 12.3 with exactly two digits after the decimal point, e.g. 12.30 I've tried the whole format(), formatC() and prettyNum() functions but did not have any success with it. This should work with

Re: [R] Printing 2 digits after decimal point

2010-02-15 Thread Linlin Yan
format(x, nsmall = 2) On Mon, Feb 15, 2010 at 5:41 PM, t.wun...@stud.uni-heidelberg.de wrote: Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g. x - 12.3 with exactly two digits after the decimal point, e.g. 12.30 I've tried the whole

Re: [R] Printing 2 digits after decimal point [SOLVED]

2010-02-15 Thread Sharpie
T.Wunder wrote: Hi, I'm sorry, I've found the right answer: x - 0 formatC(x,digits=2, format=f) [1] 0.00 The above worked perfectly! Thanks Best wishes ;) Tom That old warhorse, sprintf(), can also be a trusty steed in situations like this. -Charlie -- View this message in