我有一个问题,fread()使用"\"作为目录分隔符读取一列目录路径.问题是尾随目录分隔符在fread()中引发错误.
对于以下示例csv文件,
file,size
"windows\user",123
Run Code Online (Sandbox Code Playgroud)
fread()和read.csv()都同意并且都将\转换为\\
> fread("example.csv")
file size
1: windows\\user 123
Run Code Online (Sandbox Code Playgroud)
但是,对于以下示例,fread()在read.csv()没问题时给出错误.
file,size
"windows\user\",123
Run Code Online (Sandbox Code Playgroud)
read.csv()给出
> read.csv("example.csv")
file size
1 windows\\user\\ 123
Run Code Online (Sandbox Code Playgroud)
虽然fread()错误看起来像这样
> fread("example.csv",verbose=TRUE)
Input contains no \n. Taking this to be a filename to open
File opened, filesize is 0.000 GB
File is opened and mapped ok
Detected eol as \r\n (CRLF) in that order, the Windows standard.
Using line 2 to detect sep (the last non blank line in the first 'autostart') ... sep=','
Found 2 …Run Code Online (Sandbox Code Playgroud)