Hi all; I need to create ASCII files as output from R and I'm using sink(), cat(), and paste() for this. My problem is that the ASCII files hace several columns, and I would like to know if intermediate columns (the second one for example) could be alineated to the right. My values are integer ranging from 1 to 1000. Thanks a lot. Best regards, Javier
On Sun, 21 Mar 2004 21:47:33 +0100, you wrote:>Hi all; >I need to create ASCII files as output from R and I'm using sink(), cat(), >and paste() for this. >My problem is that the ASCII files hace several columns, and I would like to >know if intermediate columns (the second one for example) could be alineated >to the right. My values are integer ranging from 1 to 1000.You want to look at the formatC function together with paste to build up the lines you want. For example,> x <- sample(200,5) > y <- sample(200,5) > cat(paste(formatC(x, width=5), formatC(y, width=5)), sep='\n')84 36 159 64 55 78 59 51 132 107 Duncan Murdoch
Javier, You can do that with "write.table". Regards, Carlos. -----Mensaje original----- De: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] En nombre de javier garcia - CEBAS Enviado el: domingo, 21 de marzo de 2004 21:48 Para: r-help at stat.math.ethz.ch Asunto: [R] formated output Hi all; I need to create ASCII files as output from R and I'm using sink(), cat(), and paste() for this. My problem is that the ASCII files hace several columns, and I would like to know if intermediate columns (the second one for example) could be alineated to the right. My values are integer ranging from 1 to 1000. Thanks a lot. Best regards, Javier ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html