[R] reading in a file with multiple data types

Siew Leng TENG siewlengteng at yahoo.com
Sun Sep 14 20:57:18 CEST 2003


Hi,

I have a data file which contains multiple data types
(char and numeric) alongside with line spaces, tabs
and spaces. I hope to extract out the numeric blocks
of the data, probably as matrices or dataframes where
each line in the data block is a corresponding row in
the dataframe/ matrix.

I have tried using many R read functions but they do
not seem to yield the appropriate structure that
allows the extraction of the numeric blocks correctly
(due to the line spaces, tabs and spaces).

I gratefully appreciate any advice and suggestion on
how to obtain the desired data matrices/ dataframes
from this data file in R.

Thank you,
Siew-Leng
*Using R1.7.1. on windows ME, and on Unix.

------------------------------------
My data file contains data in the following block
structure :

1) block of a summary (char)
2) line spaces
3) text line
4) Data : stored as : 
number \t number (spc) number (spc) number (spc) ...
and so on.
[the number of numeric values stored at this line is
not fixed]
5) same structure from 2 - 4

An example of my data (in exact format) is given below
:


Final results
Final value 75.162993 
First case value 11
First case value 10
Case indices 
3 4 1 5 6 7 8 9 10 11 

Estimates : 
8.875350 
3.894280 
7.972684 
4.934348 
0.012406 
0.002134 
-0.024216 
0.072946 
-0.000468 
0.042769 
-0.126641 

Final components :
3 	 0 2 2 

4 	 0 1 

1 	 

5 	 0 0 0 1 2 

6 	 1 1 1 1 1 1 

7 	 1 1 1 1 1 

8 	 1 1 1 1 

9 	 0 0 0 0 1 1 2 

10 	 2 2 

11 	 0 2




More information about the R-help mailing list