[R] problem of fixed-formated output using sprintf

From: YIHSU CHEN <yschen_at_jhu.edu>
Date: Wed 12 Jul 2006 - 02:09:48 EST


Dear R users:

I'm trying to generate a output file with fixed format using function "sprintf" in R. However, the execution time in R is very long even the toy data (smaller size df) seems to work fine. The syntax that I used is as follows:

df.fmt <- sprintf("%2s%2s%2.4f", df$v1, df$v2, df$v3) write.table(df.fmt, output.name,...)

The actual dataset is a df with the dimention of 67944 by 34. I'm wondering whether there is an elegant way of doing it. I would like output in a txt file.

Many thanks.

Yihsu Chen
The Johns Hopkins University



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 12 02:17:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 04:17:44 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.