load2 {BBmisc}R Documentation

Load RData file and return objects in it.

Description

Load RData file and return objects in it.

Usage

load2(file, parts, simplify = TRUE, envir, impute)

Arguments

file

[character(1)]
File to load.

parts

[character]
Elements in file to load. Default is all.

simplify

[logical(1)]
If TRUE, a list is only returned if parts and the file contain both more than 1 element, otherwise the element is directly returned. Default is TRUE.

envir

[environment(1)]
Assign objects to this environment. Default is not to assign.

impute

[ANY]
If file does not exists, return impute instead. Default is missing which will result in an exception if file is not found.

Value

Either a single object or a list.

Examples

fn = tempfile()
save2(file=fn, a=1, b=2, c=3)
load2(fn, parts="a")
## [1] 1
load2(fn, parts=c("a", "c"))
## $a
## [1] 1
## 
## $c
## [1] 3

[Package BBmisc version 1.7 Index]