2017-02-28 61 views
0

读取文件我想这是在这里enter link description hereR:不明结构

第15行描述的文件,但我不希望他们在文件中读取。所以我使用skip = 15。

具体来说,我用:

xx <- read.table(file = "4br_grossc.comments", skip=15) 

我得到如下:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 1 did not have 12 elements 

如何处理这个文件有什么建议?我期望它有三个字段(仅) - 触发号码,单字母代码和最后一个字段中的自由流动文本。

非常感谢!

+0

看起来像一个固定宽度的文件 - 看'read.fwf' – thelatemail

+0

我不知道最后一个字段具有相同的宽度始终?是否可以保持最后一个宽度未指定?如果是这样,怎么样? – user3236841

+0

只是使它成为一个非常高的数字 - 查看源数据,它应该不是一个问题,有很长的字符串。 – thelatemail

回答

0

你试过:

xx <- read.table(file = "4br_grossc.comments", skip=15, header=TRUE) 
+0

这不起作用。我得到:错误在read.table(file =“4br_grossc.comments”,skip = 15,header = TRUE): 列列数多于列名称 – user3236841

+0

'read.table'使用空格作为默认分隔符,所以这会分裂第三场因此是错误。 – neilfws