使用fread.data.table删除偶尔的回车?

时间:2015-06-11 06:52:31

标签: r data.table line-endings

我正在使用data.table包中的fread()函数并处理凌乱的输入文件。一些线路末端有一个额外的回车。是否可以忽略^ M?

我可以通过其他方式对其进行预处理,但如果我可以直接使用fread来处理它...

它目前给我这个错误:

Error in fread(s$file, sep = "\t", nrows = 1, skip = 0, header = FALSE) : 
Line ending is \r\r\n. R's download.file() appears to add the extra \r in 
text mode on Windows. Please download again in binary mode (mode='wb') 
which might be faster too. Alternatively, pass the URL directly to 
fread and it will download the file in binary mode for you. 

0 个答案:

没有答案