R没有看到磁盘上存在的文件

时间:2015-07-22 22:00:03

标签: r read.table

我正在尝试将文件读入我磁盘上的R中 - list.files函数看到了他,但file.existsread.table没有...

可能导致R没有看到某些文件而导致无法阅读的原因是什么?

代码和错误如下:

> list.files(x)
[1] "ACC.rnaseqv2__illuminahiseq_rnaseqv2__unc_edu__Level_3__RSEM_genes_normalized__data.data.txt"
[2] "MANIFEST.txt"                                                                                
> list.files(x)[1]
[1] "ACC.rnaseqv2__illuminahiseq_rnaseqv2__unc_edu__Level_3__RSEM_genes_normalized__data.data.txt"
> file.exists(paste0(x,list.files(x)[1]))
[1] FALSE
> x
[1] "D:/GitHub/RTCGA.data/RTCGA.rnaseq/data2/gdac.broadinstitute.org_ACC.Merge_rnaseqv2__illuminahiseq_rnaseqv2__unc_edu__Level_3__RSEM_genes_normalized__data.Level_3.2015060100.0.0/"
> read.table(paste0(x,list.files(x)[1])) -> y
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'D:/GitHub/RTCGA.data/RTCGA.rnaseq/data2/gdac.broadinstitute.org_ACC.Merge_rnaseqv2__illuminahiseq_rnaseqv2__unc_edu__Level_3__RSEM_genes_normalized__data.Level_3.2015060100.0.0/ACC.rnaseqv2__illuminahiseq_rnaseqv2__unc_edu__Level_3__RSEM_genes_normalized__data.data.txt': No such file or directory

1 个答案:

答案 0 :(得分:4)

Windows中有一些API限制为255个字符路径。例如。见Has Windows 7 Fixed the 255 Character File Path Limit?

此处的总路径长度为269个字符。我原以为是问题。我会重命名文件夹,文件或两者。或者我想你可以改变操作系统,但那似乎更难的工作! (注意我使用Windows作为我的主要操作系统的选择,但我确实发现它的一些限制令人沮丧,特别是对于像R这样的跨平台工具。)

相关问题