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 what is NULL, nothing is written to the tape.

fileFormat

File format; should be left default. See guessFileFormat and makeFileFormat for details.

safe

If "try" or "retry", rtape will use dirlock to ensure that no other rtape safe appending is in progress. In case of conflict, the function in "try" mode immediately returns FALSE and does not try again, while in "retry" mode it sleeps retryTime seconds and tries again till the dirlock is opened.

retryTime

If safe is "retry", this parameter sets the interval between writing attempts. Expressed in seconds.

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')

[Package rtape version 2.2 Index]