Answer to question 3: Can I control where to store *.ff files?
ff files are by default saved in getOption("fftempdir")
. You can change this by changing that option
require(ff)
getOption("fftempdir")
[1] "/tmp/RtmpkneHQo"
options(fftempdir = "/home/janw")
x <- ff(1:10)
filename(x)
[1] "/home/janw/ff12153b63d8c1.ff"
list.files("/home/janw", pattern = ".ff")
[1] "ff12153b63d8c1.ff"
Answer to question 2: Can I delete *.ff files once I see them?
Of course you can but you might be loosing data which you are using in an R process (every ff object is backed by an .ff file - so if you remove that file, you no longer have the data). But if you have ffsaved
the data somewhere, you can safely remove the .ff files as you can load the data again using ffload
. See answer to question 1.
Answer to question 1: Are the *.ff created somewhere when I use ffsave or after I use ffload(fileName)? u
The .ff files were already on your disk before you called ffsave. What ffsave does is simply zipping the .ff files of the specified objects you indicated to save in a directory. Once you have done this, you can safely remove the .ff files as you can reload them using ffload.
ffsave(x, file = "/home/janw/mydata")
[1] " adding: home/janw/ff12153b63d8c1.ff (deflated 35%)"
list.files("/home/janw", pattern = ".ff$")
[1] "ff12153b63d8c1.ff"
list.files("/home/janw", pattern = "mydata")
[1] "mydata.ffData" "mydata.RData"
## Now what happens if we remove the .ff file of the x variable - it is no longer accessible
file.remove("/home/janw/ff12153b63d8c1.ff")
x[1:2]
opening ff /home/janw/ff12153b63d8c1.ff
Error: file.access(filename, 0) == 0 is not TRUE
## And we are ffloading the data back
ffload("/home/janw/mydata", overwrite=TRUE)
[1] "home/janw/ff12153b63d8c1.ff"
## Waw, it is back!
list.files("/home/janw", pattern = ".ff$")
[1] "ff12153b63d8c1.ff"
## And we can access it again.
x[1:2]
opening ff /home/janw/ff12153b63d8c1.ff
[1] 1 2
When ffsaving, you will have a file with extension .ffData and one with .RData. The .ffData file contains the raw .ff files, the .RData file contains the virtual part (levels of factors e.g. and links to the raw .ff files)