load_filtered: Variant of 'load()' that allows excluding specific names

View source: R/rdata_io.R

load_filteredR Documentation

Variant of load() that allows excluding specific names

Description

If you want to load every object in an R data file except for a specific set of variable names that you wish to exclude, this function makes it easy to do so.

Usage

load_filtered(file, envir = parent.frame(), ..., exclude = NULL)

Arguments

file, envir, ...

These arguments have the same meaning as in load().

exclude

Character vector of variable names not to load.

See Also

load()

Examples


x <- 5
y <- 3
datafile <- tempfile(fileext = ".rda")
# Only saves y, not x
save.image(datafile)
# Set new values which can be overridden by loading the old ones.
x <- 10
y <- 10
load_filtered(datafile, exclude = "x")
# x is still 10, but y is now 3 again
mget(c("x", "y"))


DarwinAwardWinner/rctutils documentation built on July 22, 2022, 5:19 a.m.