toc: List the elements in a serialized file

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Save.R

Description

This provides a table of contents for a previously saved file. The idea is that this provides a simple way to find out what is in an rda file. It can return just the names or alternatively the name and class of each object.

Currently, this loads the entire file but into a separate environnment. One can specify the environment and this allows the caller to load the objects to see what is in the file and then access individual elements without polluting the global environment. In the future, we might be able to extract the table of contents without loading the objects.

Usage

1
toc(file, names.only = FALSE, e = new.env())

Arguments

file

the connection or file name in which to find the serialized data

names.only

a logical value indicating whether to return just the names of the symbols in the serialized data, or if FALSE to return their types and sizes also.

e

the environment into which the serialized objects should be deserialized. In the future, this may disappear when we can extract the information without explicitly loading the objects.

Value

Either a character vector giving the names of the variables/symbols in the serialized data or a named character vector giving the symbol name and class pairs.

Author(s)

Duncan Temple Lang

References

save and load in R's base package.

See Also

save save load

Examples

1
2
3
4
5
6
7
 x = 1
 y = 2
 z = 3

 filename = paste(tempfile(), ".rda", sep = "")
 save(x, y, z, file = filename)
 toc(filename)

omegahat/RTiming documentation built on May 24, 2019, 1:55 p.m.