最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

r - Error when trying to open ff object after moving ffarchive to a different location - Stack Overflow

programmeradmin4浏览0评论

I just got the following error on a Windows computer when trying to open an .ff file after moving it to another location:

> open(my_ff_matrix_1)
Error in open.ff(all_results_wo_estimates_ff) : 
  file.access(filename, 0) == 0 is not TRUE

This is how I loaded the ffarchive:

ff::ffinfo( path_to_ff_files_in_new_location )
# $rootpath is no longer correct as it points to the old location of the ffarchive, so
# I will provide the path to the new location as the rootpath argument in ffload.

# Load ffarchive using the new location as rootpath
ff::ffload( ff_files_path
            # Where the files from the ffarchive should be extracted to:
            , rootpath = path_to_new_location
            , overwrite = TRUE
)

Loading the ffarchive with ffload() went as expected:

> ff::ffload( ff_files_path
+             # Where the files from the ffarchive should be extracted to:
+             , rootpath = path_to_new_location 
+             , overwrite = TRUE
+ )
[1] "ff_file_1.ff"            
[2] "ff_file_2.ff"
> class(my_ff_matrix_1)
[1] "ff_matrix" "ff_array"  "ff"     
> class(my_ff_matrix_2)
[1] "ff_matrix" "ff_array"  "ff"     
> dim(my_ff_matrix_1)
[1] 1220406       5

However, trying to access the contents of the ff_matrices resulted in the aforementioned error message:

> my_ff_matrix_1[1:5, ]
opening ff C:/Path/to/the/file/which/was/placed/in/the/specified/rootpath/ff_file_1.ff
Error in open.ff(x, assert = TRUE) : 
  file.access(filename, 0) == 0 is not TRUE

I just got the following error on a Windows computer when trying to open an .ff file after moving it to another location:

> open(my_ff_matrix_1)
Error in open.ff(all_results_wo_estimates_ff) : 
  file.access(filename, 0) == 0 is not TRUE

This is how I loaded the ffarchive:

ff::ffinfo( path_to_ff_files_in_new_location )
# $rootpath is no longer correct as it points to the old location of the ffarchive, so
# I will provide the path to the new location as the rootpath argument in ffload.

# Load ffarchive using the new location as rootpath
ff::ffload( ff_files_path
            # Where the files from the ffarchive should be extracted to:
            , rootpath = path_to_new_location
            , overwrite = TRUE
)

Loading the ffarchive with ffload() went as expected:

> ff::ffload( ff_files_path
+             # Where the files from the ffarchive should be extracted to:
+             , rootpath = path_to_new_location 
+             , overwrite = TRUE
+ )
[1] "ff_file_1.ff"            
[2] "ff_file_2.ff"
> class(my_ff_matrix_1)
[1] "ff_matrix" "ff_array"  "ff"     
> class(my_ff_matrix_2)
[1] "ff_matrix" "ff_array"  "ff"     
> dim(my_ff_matrix_1)
[1] 1220406       5

However, trying to access the contents of the ff_matrices resulted in the aforementioned error message:

> my_ff_matrix_1[1:5, ]
opening ff C:/Path/to/the/file/which/was/placed/in/the/specified/rootpath/ff_file_1.ff
Error in open.ff(x, assert = TRUE) : 
  file.access(filename, 0) == 0 is not TRUE
Share Improve this question asked yesterday E. NygaardE. Nygaard 1812 silver badges8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

It turns out that the issue was that the new file paths exceed Windows' maximum path length (256 characters):

> physical(my_ff_matrix_1)$filename %>% nchar()
[1] 262

Moving the ffarchive to a location such that physical(my_ff_matrix_1)$filename %>% nchar() was less than 256 solved the issue.

发布评论

评论列表(0)

  1. 暂无评论