fread(data.table)锁定文件

时间:2013-09-03 16:25:04

标签: r data.table

我使用了fread包中的data.table,当我尝试修改或删除文件时(只需用记事本打开),窗口说:

enter image description here

如何解锁此绑定?

编辑:

在R中尝试给出相同的

cat(file="C:/Users/MCarrie/Desktop/test/test2.txt")
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:/Users/MCarrie/Desktop/test/test2.txt': Permission denied

信息:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.8.8

loaded via a namespace (and not attached):
[1] tools_3.0.1

> showConnections(all=T)
  description class      mode text   isopen   can read can write
0 "stdin"     "terminal" "r"  "text" "opened" "yes"    "no"     
1 "stdout"    "terminal" "w"  "text" "opened" "no"     "yes"    
2 "stderr"    "terminal" "w"  "text" "opened" "no"     "yes"  

正在阅读的文件:(缺少引用的报价)

"AA",3,4,5,"w"
"ss,2,3,4,"s"
"ww",2,3,3,"s"

1 个答案:

答案 0 :(得分:4)

请使用data.table v1.8.11重试。在data.table homepage上有适用于Windows的新.zip。

来自NEWS

  

如果fread返回数据错误(例如特定行上的不平衡报价),它现在首先关闭文件,而不是保持锁定打开,这是Windows唯一的问题。感谢nigmastar的报道和Carl Witthoft的提示。测试补充说。