Incomplete final line found - what's the big deal?

Occasionally, when I use the readLines() functions I get the following warning message:

readLines("XXX") : incomplete final line found on 'XXX'

To fix this warning message is straight forward, just add a newline at the end of the file.

My questions are:

  • Why is this an issue?
  • What are the (historical?) reasons behind this warning?
  • Is it good practice to promote this warning to an error?

Note: RStudio has an option that automatically adds a line breaks: Code -> Saving

1 Like