[R] Writing to a file with fixed precision

2006-05-18 Thread YIHSU CHEN
Dear R users; A follow-up question regarding writing to a file with fixed precision: Assuming for each column of x, I would like to have a different format, then I modify the code as: x.fmt - apply(x, 1, function(x) sprintf(%.14f %.10f %2.5f, x)) where three different formats are %.14f %.10f

Re: [R] Writing to a file with fixed precision

2006-05-18 Thread Duncan Murdoch
On 5/18/2006 8:20 PM, YIHSU CHEN wrote: Dear R users; A follow-up question regarding writing to a file with fixed precision: Assuming for each column of x, I would like to have a different format, then I modify the code as: x.fmt - apply(x, 1, function(x) sprintf(%.14f %.10f %2.5f, x))

Re: [R] Writing to a file with fixed precision

2005-10-11 Thread Prof Brian Ripley
On Mon, 10 Oct 2005, Marc Schwartz wrote: On Mon, 2005-10-10 at 19:50 -0400, Richard Hedger wrote: Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the following to a file: 1.00 1.40

Re: [R] Writing to a file with fixed precision

2005-10-11 Thread Marc Schwartz
On Tue, 2005-10-11 at 08:42 +0100, Prof Brian Ripley wrote: On Mon, 10 Oct 2005, Marc Schwartz wrote: On Mon, 2005-10-10 at 19:50 -0400, Richard Hedger wrote: Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the

[R] Writing to a file with fixed precision

2005-10-10 Thread Richard Hedger
Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the following to a file: 1.00 1.40 2.00 I was wondering if there was a function to do this in R? Thanks, Richard Richard Hedger

Re: [R] Writing to a file with fixed precision

2005-10-10 Thread Marc Schwartz
On Mon, 2005-10-10 at 19:50 -0400, Richard Hedger wrote: Hi, I'm trying to ouput to a filled with a fixed precision: eg. if I have data x=c(1.0,1.4,2.0), I want to be able to ouput the following to a file: 1.00 1.40 2.00 I was wondering if there was a