[R] Reading a file created with Fortran

From: Dennis Fisher <fisher_at_plessthan.com>
Date: Tue, 26 Feb 2008 10:16:11 -0800


Colleagues,

I am trying to read a file written by Fortran. Several lines of the file are pasted below:

101   06e+050280.9777.484208.18147.20.246350.4020.7308717.882600 1 1
101 0.5    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101   1    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101 1.5    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101   2    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101 2.5    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101   3    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101   4    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0
101   6    00280.9777.484208.18147.20.246350.4020.7308717.882600 0 0

The fortran format statement is:
	(E3.0,E4.0,E5.0,E1.0,3E6.0,E5.0,E7.0,E5.0,E7.0,E6.0,E3.0,2F2.0)

The read.table command cannot parse the table correctly because there are no spaces between columns. Although readLines reads the file, it does not separate the elements into columns. I suspect that the "what" option of "scan" accomplishes my intent although its implementation is poorly document in help (or perhaps I am too dense to understand it).

Can anyone advise as to an efficient means to read these data and separate into columns?

Thanks.

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 26 Feb 2008 - 18:21:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Feb 2008 - 19:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive