Controlling widths in write.fwf()
On 14/04/2009 7:28 PM, Vemuri, Aparna wrote:
Is there a way to handle the widths of values being written to a file using wrtite.fwf() ? For example, I used read.fwf(file, width.vector) to read a file. After making the necessary data manipulation, I want to write the data to a new file in the same width.vector format. Is there a way to specify this?
There is no write.fwf function, but you can use sprintf() to convert things to strings and writeLines to write those strings. There's a lot of flexibility in the formats allowed; see the man page. Duncan Murdoch