restoreS4Methods: Restore Session Class Definitions

Description Usage Arguments Value Author(s) Examples

Description

Restores the class definitions from an R binary file to the specified environment.

Usage

1
restoreS4Methods(file = "session.RData", envir = .GlobalEnv, clean = TRUE, srcEnv)

Arguments

file

path to an R binary file

envir

the environment into which the class definitions should be restored.

clean

boolean indicating whether the environment should be purged of existing class definitions prior to restoring

srcEnv

environment from which to restore generics. if this argument is provided the "file" arguments is ignored.

Value

This method is executed for it's side-effects.

Author(s)

Matthew D. Furia matt.furia@sagebase.org

https://github.com/MattNapsAlot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## make some methods
setGeneric("foo", def = function(bar) standardGeneric("foo"))
setMethod("foo", definition = function(bar) print(foo))

## save the session
sessionFile <- tempfile(fileext=".rbin")
saveSession(list = ls(), file = sessionFile)

## create an environment where they can be restored
env <- new.env()

## restore the generic
restoreS4Methods(file = sessionFile, envir = env)
getGenerics(env)
findMethods("foo", where=env)

Sage-Bionetworks/sessionTools documentation built on May 9, 2019, 12:13 p.m.