Get or set filename
filename(x, ...) filename(x, ...) <- value ## Default S3 method: filename(x, ...) ## S3 method for class 'ff_pointer' filename(x, ...) ## S3 method for class 'ffdf' filename(x, ...) ## S3 replacement method for class 'ff' filename(x, ...) <- value pattern(x, ...) pattern(x, ...) <- value ## S3 method for class 'ff' pattern(x, ...) ## S3 replacement method for class 'ff' pattern(x, ...) <- value ## S3 replacement method for class 'ffdf' pattern(x, ...) <- value
x |
a ram or ff object, or for pattern assignment only - a ffdf object |
value |
a new filename |
... |
dummy to keep R CMD CHECK quiet |
Assigning a filename<- means renaming the corresponding file on disk - even for ram objects. If that fails, the assignment fails.
If a file is moved in or out of getOption("fftempdir") the finalizer is changed accordingly to 'delete' in getOption("fftempdir") and 'close' otherwise.
A pattern is an incomplete filename (optional path and optional filename-prefix) that is turned to filenames by
adding a random string using and optionally an extension from optionally an extension from getOption("ffextension") (see fftempfile).
filename<- exhibits R's standard behaviour of considering "filename" and "./filename" both to be located in getwd.
By constrast pattern<- will create "filename" without path in getOption("fftempdir") and only "./filename" in getwd.
Jens Oehlschlägel
## Not run:
message("Neither giving pattern nor filename gives a random filename
with extension ffextension in fftempdir")
x <- ff(1:12)
finalizer(x)
filename(x)
message("Giving a pattern with just a prefix moves to a random filename
beginning with the prefix in fftempdir")
pattern(x) <- "myprefix_"
filename(x)
message("Giving a pattern with a path and prefix moves to a random filename
beginning with prefix in path (use . for getwd) ")
pattern(x) <- "./myprefix"
filename(x)
message("Giving a filename moves to exactly this filename and extension
in the R-expected place) ")
if (!file.exists("./myfilename.myextension")){
filename(x) <- "./myfilename.myextension"
filename(x)
}
message("NOTE that the finalizer has changed from 'delete' to 'close':
now WE are responsible for deleting the file - NOT the finalizer")
finalizer(x)
delete(x)
rm(x)
## End(Not run)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.