Bring Back Data-Dumped Objects

DESCRIPTION:

Puts data objects that had previously been put into a file with data.dump into the specified database.

USAGE:

data.restore(connection, print=F, where=1) 

REQUIRED ARGUMENTS:

connection
character string, interpreted as a file name or connection object from which the dumped data objects will be read.

OPTIONAL ARGUMENTS:

print
If TRUE, print a single line summary of each object, just before it is restored from the file.
where
the database for the restored objects. Defaults to the working data.

SIDE EFFECTS:

all data objects stored on connection are placed in the where directory. A summary of the objects is printed if print is TRUE.

DETAILS:

Normally, the file supplied to data.restore was previously created (maybe on another machine) by a call to data.dump. The objects should exactly reproduce those dumped, up to numerical differences arising from inter-machine incompatibility. In particular, the classes of objects and their components are retained. The definitions of the same class on the original database need to be compatible with those on the restored database. Since meta-data can also be dumped and restored by data.dump and data.restore, it is good practice when in doubt to dump the meta-objects referring to a newly defined class as well. These should be restored first, and then any objects from this class.

The data.restore function looks for a header on the file identifying it as ordinary or meta-data. If neither pre-defined header is found, the file is assumed to be from an older version of S-PLUS. You shouldn't have to worry about this; so long as objects are dumped by data.dump and restored consistently by data.restore, everything should work.

NOTE:

This function is not affected by the current search list.

SEE ALSO:

, , .

EXAMPLES:

data.dump(objects(),file="all.data") 
data.restore("all.data") 
# suppose "myNewClass" is a newly defined class  
data.dump(metaObjects(1, p = "myNewClass"), "forMyNewClass", meta=T)  
# ... and then later  
         data.restore("myNewClass") # no meta= argument needed  
# now go on to dump and restore objects of this class