Skip to content

read.table and newline

2 messages · Andrea Peters, Peter Dalgaard

#
Hi,
yesterday I installed the current R-devel and now I get
the following warning message for program codes which made no
problems under version R-1.2.3: 

Example:
R> read.table("test.dat")
Warning message: 
incomplete final line in: readLines(con, n, ok)
 
where `test.dat' looks like

peters at artemis:~ > cat test.dat 
1 2 3peters at artemis:~ > 

i.e. without a newline at the end. 

The warning can be suppressed if the last line in "test.dat" ends with
"\n". Is there a reason why "test.dat" should end with "\n" or is this a
bug in R-devel?   

Andrea
_                           
platform i686-pc-linux-gnu           
arch     i686                        
os       linux-gnu                   
system   i686, linux-gnu             
status   Under development (unstable)
major    1                           
minor    3.0                         
year     2001                        
month    06                          
day      11                          
language R                           

-------------------------------------------------------------------------

	Dipl.-Stat. Andrea Peters
	Institut für Medizininformatik, Biometrie und Epidemiologie
	Waldstrasse 6, D-91054 Erlangen, Deutschland
	Tel: ++49-9131-85-22722
	Fax: ++49-9131-85-25740

-------------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Andrea Peters <Peters.Andrea at imbe.imed.uni-erlangen.de> writes:
It's the normal convention for text files on Unix et al. that each
line is terminated with a \n. Not having one could be a sign that the
file was corrupted, hence the warning. Other utilities will also give
warnings, e.g. vim will display the file with "[noeol]", other vi-s
will complain and fix the last line.