2016-03-29 9 views
-1

ffパッケージを使用して格納されたcrlmmパッケージで作成されたCNSetオブジェクトがありました。ffファイルを移動した後のffオブジェクトのロード

RDataファイルとして保存しました(save機能を使用し、ffsaveを使用していません)。そして、ffファイルを別の場所に移動しなければなりませんでした。次に、load関数を使用してオブジェクトをロードしようとしました。しかし、オブジェクトの一部にアクセスしたときに、元の場所にあるffファイルが見つかりませんでした。

ldPath機能を使用して新しい場所を設定しましたが、それでもまだ古いパスが検索されています。

例:

library(ff) 
ldPath('/new_location') 
load('object.RData') 
summary(g) 
#Works, print: 
#Length Class Mode 
#1 CNSet  S4 

calls(g)[1] 
#Raises the next error: 

opening ff /old/location/calld49920a2df79.ff

Error: file.access(filename, 0) == 0 is not TRUE

physical(x) 

NULL

すべてのヘルプは理解されるであろう。

答えて

0

ffオブジェクトxのファイルパスをphysical(x) <- 'my_file.ff'と指定できます。例:

library(ff) 

old <- file.path(tempdir(), 'old.ff')   # this will be the original file path 
new <- file.path(tempdir(), 'new.ff')   # this will be the new file path 
x <- ff(1:4, filename=old)     # create the original ff file 
save(x, file = file.path(tempdir(), 'x.rda')) # save the ff object 
close(x)          # close the ff object 
file.rename(old, new)       # rename the file 
file.remove(old)        # delete the old file 
load(file.path(tempdir(), 'x.rda'))   # load the ff object 
physical(x)$filename <- new     # assign the new file path 

head(x) 
## opening ff C:\Users\John\AppData\Local\Temp\Rtmp2ZEkgw/new.ff 
## [1] 1 2 3 4 
関連する問題