rtapeAdd {rtape} | R Documentation |
Add object to the tape.
Description
Add object to the tape.
Usage
rtapeAdd(fName, what, skipNULLs=FALSE, fileFormat=guessFileFormat(fName),
safe=FALSE, retryTime=0.1)
Arguments
fName |
Name of the tape file. |
what |
Object to be stored. |
skipNULLs |
If true and |
fileFormat |
File format; should be left default. See |
safe |
If |
retryTime |
If |
Details
This function serializes and appends a given object on the end of the tape file. If the tape file does not exists, it is created.
Note
Remember to use the same fileFormat
value to all writes to a certain tape (or use default format guesser to guarantee this); if not, the tape will become unreadable. For the same reason, don't try to put custom headers/footers or append other data inside tape stream.
This function is thread/process safe only if you use safe
mode. However, in this case it may jam on a broken dirlock (for instance when the locking R process crashed during write); you may fix this problem manually by removing the locking dir. Its name is always .rtape_<tape file name>_lock
. Waiting in retry mode is performed via Sys.sleep
, so it is not a busy wait.
Author(s)
Miron B. Kursa M.Kursa@icm.edu.pl
Examples
unlink('tmp.tape')
#Record something on the tape
rtapeAdd('tmp.tape',iris)
rtapeAdd('tmp.tape',sin(1:10))
#Read whole tape to the list, so we could examine it
rtapeAsList('tmp.tape')->stored
print(stored)
unlink('tmp.tape')