Duncan I tried writeLines. But I need to print about 230000 lines and it is really slow.
Thanks Aparna -----Original Message----- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: Tuesday, April 14, 2009 4:34 PM To: Vemuri, Aparna Cc: r-help@r-project.org Subject: Re: [R] 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 ______________________________________________ R-help@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.