Skip to content
Prev 67626 / 398525 Next

data manipulation

On Wed, 2005-04-13 at 20:56 -0400, Yoko Nakajima wrote:
You probably change some default setting in scan(). By default it treats
'white space' as field delimiters.

Using your data above, which I save in file called 'test.dat':
Read 58 items
[1]  2 29
Col1 Col2    Col3    Col4    Col5   Col6    Col7    Col8    Col9
[1,]    4   17  1.0000 -0.1668 -0.5062 0.3640 -0.5081  0.8142 -0.0445
[2,]    1    1 -5.1536 -2.3412  0.9621 0.3678 -0.2227 -0.0389 -0.0578
       Col10   Col11   Col12   Col13   Col14  Col15 Col16 Col17   Col18
[1,] -0.1175  0.8673 -0.0796 -0.1716 -0.7014 0.5611     1     2 -5.1536
[2,] -0.1232 -0.1033 -0.0341 -0.1801  0.6578 4.0000    17     1 -0.1668
       Col19  Col20   Col21   Col22   Col23   Col24   Col25   Col26
[1,] -2.3412 0.9621  0.3678 -0.2227 -0.0389 -0.0578 -0.1232 -0.1033
[2,] -0.5062 0.3640 -0.5081  0.8142 -0.0445 -0.1175  0.8673 -0.0796
       Col27   Col28  Col29
[1,] -0.0341 -0.1801 0.6578
[2,] -0.1716 -0.7014 0.5611

In this case, 'mat' is a matrix with 2 rows and 29 columns.

You can restructure this differently as per your requirements.

HTH,

Marc Schwartz