In read.table(): incomplete final line found by readTableHeader

前端 未结 7 2042
谎友^
谎友^ 2020-12-29 21:58

I have a CSV when I try to read.csv() that file, I get the warning warning message:

In read.table(file = file, header = header, sep = sep, quote         


        
7条回答
  •  悲&欢浪女
    2020-12-29 22:41

    Having a "proper" CSV file depends on the software that was used to generate it in the first place.

    Consider Google Sheets. The warning will be issued every time that the CSV file -- downloaded via utils::download.file -- contains less than five lines. This likely is related to the fact that (utils:read.table):

    The number of data columns is determined by looking at the first five lines of input (or the whole input if it has less than five lines), or from the length of col.names if it is specified and is longer.

    In my short experience, if the data in the CSV file is rectangular, then the warning can be ignored.

    Now consider LibreOffice Calc. There won't be any warnings, irrespective of the number of lines in the CSV file.

提交回复
热议问题