load2: Load RData file and return objects in it

View source: R/load2.R

load2R Documentation

Load RData file and return objects in it

Description

Loads an RData file and returns the objects directly instead of loading them into an environment.

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")
load2(fn, parts = c("a", "c"))

BBmisc documentation built on Nov. 6, 2026, 1:06 a.m.