R: Dump objects of database

dumpObjects {filehash} | R Documentation

## Dump objects of database

### Description

Dump R objects to a filehash database

### Usage

    dumpObjects(..., list = character(0), dbName, type = NULL, envir = parent.frame())
    dumpImage(dbName = "Rworkspace", type = NULL)
    dumpDF(data, dbName = NULL, type = NULL)
    dumpList(data, dbName = NULL, type = NULL)
    dumpEnv(env, dbName)

### Arguments

`...` | R objects to dump
`list` | character vector of names of objects to dump
`dbName` | character, name of database to which objects should be dumped
`type` | type of database to create
`envir` | environment from which to obtain objects
`data` | a data frame or a list
`env` | an environment

### Details

Objects dumped to a database can later be loaded via `dbLoad` or can be accessed with `dbFetch`, `dbList`, etc. Alternatively, the `with` method can be used to evaluate code in the context of a database. If a database with name `dbName` already exists, objects will be inserted into the existing database (and values for already-existing keys will be overwritten).

`dumpDF` is different in that each variable in the data frame is stored as a separate object in the database. So each variable can be read from the database separately rather than having to load the entire data frame into memory. `dumpList` works in a simlar way.

The `dumpEnv` function takes an environment and stores each element of the environment in a `filehash` database.

### Value

An object of class `"filehash"` is returned and a database is created.

### Author(s)

Roger D. Peng

### Examples

    data <- data.frame(y = rnorm(100), x = rnorm(100), z = rnorm(100))
    db <- dumpDF(data, dbName = "dataframe.dump")
    fit <- with(db, lm(y ~ x + z))
    summary(fit)

    db <- dumpList(list(a = 1, b = 2, c = 3), "list.dump")
    db$a

[Package filehash version 2.4-1 Index]