s-news
[Top] [All Lists]

printing row and column totals vertically

To: s-news@wubios.wustl.edu
Subject: printing row and column totals vertically
From: Andrew Czarn <aczarn@cs.uwa.edu.au>
Date: Mon, 27 May 2002 17:55:49 +0800 (WST)
to anyone who can assist

i implemented the following code to obtain the row and column totals
from a 2 by 2 matrix, viz

    print(rowSums(tempMatrix))
    print(colSums(tempMatrix))

the following output was obtained

"Row Totals"
0       0.05   0.1     0.15    0.2     0.25    0.3     0.35    0.4
3526.72 3546.5 3448.42 3596.79 3547.62 3662.72 3597.91 3634.43 3635.17
0.45    0.5     0.55    0.6     0.65    0.7
3555.97 3675.97 3642.94 3678.86 3775.24 3756.92

"Column Totals"
0.18    0.185  0.19    0.195   0.2     0.205 0.21    0.215   0.22    0.225
4304.04 4281.1 4289.56 4085.06 4060.17 3935  4050.73 4081.45 4052.83 4093.91
0.23    0.235   0.24
4191.95 4238.99 4617.39

what i would like splus to do is to print the results vertically, not 
horizontally, viz

"Row Totals"
0    3526.72
0.05 3546.5
0.1  3448.42
etc

the reason is that i would like to copy and paste the results into a flat 
file which i can then graph using gnuplot. gnuplot requires that the data
are in columns.

any assistance would be greatly appreciated.

thanks

andrew

Dr AST Czarn
The University of Western Australia



<Prev in Thread] Current Thread [Next in Thread>
  • printing row and column totals vertically, Andrew Czarn <=