[R] Output Data Formatting Question

Jason Rupert jasonkrupert at yahoo.com
Fri Mar 13 21:48:25 CET 2009


Within R I need to reformat my data so that the output looks like the following:
" 7 WORDS              5550         3.14159         -6.           6."

Previous folks were doing this by hand, but I would like to have a formula do it. 


That is, 
(a) 7 (place holder) on second column, then a space, 
(b) WORDS (placeholder) is a string descriptor that is left justified to column 4, 
(c) 5550 (place hoder) is right justified to column 26, 
(d) 3.14159 (place holder) is right justified to column 41, 
(e) -6. (place holder) is right justified to column 53, and
(f) 6. (place holder) is right justified to column 66. 

The basic sprintf commands did not seem like they would get me there, nor did the "paste" capability. 

After getting the data into that format I plan to use "write" to place the data in an output *.txt file. 

Thank you for any hints and tips that can be provided.




More information about the R-help mailing list