[R] incomplete final line found by readLines on ...

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 5 11:02:00 CEST 2006


readLines in R-devel has argument warn=TRUE, so you can easily change the 
behaviour if using that version of R.

On Fri, 30 Jun 2006, Taka Matzmoto wrote:

> Dear R-users
>
> I need to read some text files produced by some other software.
> I used readLines (with n = -1 ) command and then tried to find some numbers
> I liked to extract or some line numbers I like to know.
>
> The problem is that there is no empty line at the end of the text files.

The problem is actually that the final `line' does not end in an EOL mark 
(LF or CRLF as appropriate), which often indicates a broken text file.

> R gave me this warning below;
>
> In addition: Warning message:
> incomplete final line found by readLines on 'output.txt'
>
> I know this doesn't affect anything and just warning messages. Is there any
> way to prevent this warning message.
>
> Thanks
>
> Taka
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list