[R] readLines fails to read entire file

From: Dennis Fisher <fisher_at_plessthan.com>
Date: Mon, 09 Jun 2008 16:02:37 -0700


Colleagues

I have just encountered an interesting problem with readLines in R 2.7.0 in Windows Vista. I am trying to read a line that is created in the following manner:

  1. Intel Fortran (ifort) 10.1 creates two text files.
  2. The OS concatenates these files with: copy FILE1 +FILE2 FILE3 From R, I execute: readLines("FILE3") Only the first portion of the file (the original FILE1) is read - the remainder is ignored and there is no error message.

When I open FILE3 with Notepad, it shows all the text; however, between the material originating from FILE1 and FILE2, there is a single character - a right-pointing arrow. When I open the file with vi in Windows (installed under ssh), it shows ^Z. When I open the file with a hex editor (after having moved the file to a Mac), it shows that this character is 1A.

I can get around the problem by working with the files separately. However, this is not optimal. Is there a work-around that enables me to read this file (and ignore the offending character)?

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 Mon 09 Jun 2008 - 23:05:57 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 10 Jun 2008 - 08:30:38 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