toc: Table of Contents for an RDA file/stream

View source: R/readRDA.R

tocR Documentation

Table of Contents for an RDA file/stream

Description

This reads an R data (RDA) connection and identifies the top-level variables it contains. It returns a description for each of these variables, giving the R type, class, length, names.

It avoids deserializing/creating the objects as much as possible. This is useful when we are dealing with large vectors, data.frames and R objects in general.

Usage

toc(file)

Arguments

file

the name of the RDA file, or a connection

Value

An object of class RDAToc. This is a list with as many elements as there are top-level variables/objects in the RDA file. Each element is a 1-row data.frame describing that object. Each of these data.frames may have different columns as there are different characteristics described for different types.

The individual data.frames can be combined with the as.data.frame method.

One can access an element via the RDAToc object to extract the individual element from the RDA file.

Author(s)

Duncan Temple Lang

References

R Internals manual

See Also

load and Load in this package.

Examples

  f = system.file("sampleRDA", "test.rda", package = "RDAInfo")
  info = toc(f)

  print(info)

  # get the first element
  info[[1]]
  info[["mx"]]
  info$mx
  info[c("d", "a")]

  info2 = as.data.frame(info)
  info2$offset

duncantl/RDAInfo documentation built on Aug. 10, 2024, 3:17 p.m.