[R] Printing vector

Steven @yen @end|ng |rom hqu@edu@cn
Sat Jul 20 08:00:03 CEST 2019


Is there a convenient way to print a vector into rows of a specified 
column length? What I need is to print in the old FORTRAN format, viz.,

format(10F8.2)

which would print, for instance, a vector of 25 into two rows of 10 plus 
an incomplete row of 5. I managed to write a procedure for that task, as 
shown below (except that I prefer simply blanks rather than the NA). I 
am too embarrassed to even show the procedure. In short, I like to print 
in the above FORTRAN format. Thank you.

----

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.66 0.26 0.82 
0.73 0.13 0.05 0.56 0.67 0.74 0.87 [2,] 0.91 0.25 0.40 0.39 0.50 0.89 
0.07 0.84 0.14 0.75 [3,] 0.38 0.08 0.86 0.97 0.56 NA NA NA NA NA


	[[alternative HTML version deleted]]



More information about the R-help mailing list