在read.table():readTableHeader找到不完整的最后一行 [英] In read.table(): incomplete final line found by readTableHeader

查看:4495
本文介绍了在read.table():readTableHeader找到不完整的最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试 read.csv()时,我有一个CSV文件,我收到警告信息:

 在read.table(file = file,header = header,sep = sep,quote = quote,:
readTableHeader b $ b

我不能孤立的问题,尽管冲刷StackOverflow和R-帮助的解决方案。 b
$ b

这是数据的Dropbox链接: https:/ /www.dropbox.com/s/h0fp0hmnjaca9ff/PING%20CONCOURS%20DONNES.csv

解决方案

如解释 Hendrik Pon ,消息指示文件的最后一行不以行结束(EOL)字符(换行(\\\
)或回车+换行(\r\\\
))结束。



补救很简单:




  • 打开文件

  • 导航到文件的最后一行

  • 将光标置于该行的结尾

  • 按回车键/ Enter

  • 保存文件



因此这里是您的文件没有警告

  df = read.table(C:\\Users\\Administrator\\Desktop\\tp.csv,header = F, sep =;)
df
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
1日期20/12/2013 09:04 20/12/2013 09:08 20/12 / 2013 09:12 20/12/2013 09:16 20/12/2013 09:20 20/12/2013 09:24 20/12/2013 09:28 20/12/2013 09:32 20/12/2013 09:36
2 1 1,3631 1,3632 1,3634 1,3633 1,363 1,3632 1,3632 1,3632 1,3629
3 2 0,83407 0,83408 0,83415 0 ,83416 0,83404 0,83386 0,83407 0,83438 0,83472
4 3 142,35 142,38 142,41 142,4 142,41 142,42 142,39 142,42 142,4
5 4 1,2263 1,22635 1,22628 1,22618 1,22614 1,22609 1,22624 1,22643 1,2265

但我认为你不应该这样读,因为你必须重新塑造数据框,谢谢。


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 = quote,  :
  incomplete final line found by readTableHeader on ...

And I cannot isolate the problem, despite scouring StackOverflow and R-help for solutions.

This is the Dropbox link for the data: https://www.dropbox.com/s/h0fp0hmnjaca9ff/PING%20CONCOURS%20DONNES.csv

解决方案

As explained by Hendrik Pon,The message indicates that the last line of the file doesn't end with an End Of Line (EOL) character (linefeed (\n) or carriage return+linefeed (\r\n)).

The remedy is simple:

  • Open the file
  • Navigate to the very last line of the file
  • Place the cursor the end of that line
  • Press return/enter
  • Save the file

so here is your file without warning

df=read.table("C:\\Users\\Administrator\\Desktop\\tp.csv",header=F,sep=";")
 df
    V1               V2               V3               V4               V5               V6               V7               V8               V9              V10
1 Date 20/12/2013 09:04 20/12/2013 09:08 20/12/2013 09:12 20/12/2013 09:16 20/12/2013 09:20 20/12/2013 09:24 20/12/2013 09:28 20/12/2013 09:32 20/12/2013 09:36
2    1           1,3631           1,3632           1,3634           1,3633            1,363           1,3632           1,3632           1,3632           1,3629
3    2          0,83407          0,83408          0,83415          0,83416          0,83404          0,83386          0,83407          0,83438          0,83472
4    3           142,35           142,38           142,41            142,4           142,41           142,42           142,39           142,42            142,4
5    4           1,2263          1,22635          1,22628          1,22618          1,22614          1,22609          1,22624          1,22643           1,2265

But i think you should not read in this way because you have to again reshape the dataframe,thanks.

这篇关于在read.table():readTableHeader找到不完整的最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆