| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/io.R |
| 3 |
\name{lazy_save} |
| 4 |
\alias{lazy_save} |
| 5 |
\alias{lazy_load} |
| 6 |
\title{Save objects to files and lazy-load them} |
| 7 |
\usage{ |
| 8 |
lazy_save(list = NULL, path = "./", method = "auto", envir = parent.frame()) |
| 9 |
|
| 10 |
lazy_load(path = "./", method = "auto", envir = parent.frame()) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{list}{A character vector of object names. This list will be written to |
| 14 |
an index file with \code{0} as the base name (e.g., \verb{0.rds}).} |
| 15 |
|
| 16 |
\item{path}{The path to write files to / read files from.} |
| 17 |
|
| 18 |
\item{method}{The file save/load method. It can be a string (e.g., \code{rds}, |
| 19 |
\code{raw}, or \code{qs2}) or a list. See the \code{rw} argument of \code{\link[=cache_exec]{cache_exec()}}. By |
| 20 |
default, it is automatically detected by checking the existence of the |
| 21 |
index file (e.g., \verb{0.rds}, \verb{0.raw}, or \verb{0.qs2}).} |
| 22 |
|
| 23 |
\item{envir}{The environment to \link{get} or \link{assign} objects.} |
| 24 |
} |
| 25 |
\value{ |
| 26 |
\code{\link[=lazy_save]{lazy_save()}} returns invisible \code{NULL}; \code{\link[=lazy_load]{lazy_load()}} returns the |
| 27 |
object names invisibly. |
| 28 |
} |
| 29 |
\description{ |
| 30 |
The function \code{\link[=lazy_save]{lazy_save()}} saves objects to files with incremental integer |
| 31 |
names (e.g., the first object is saved to \verb{1.rds}, and the second object is |
| 32 |
saved to \verb{2.rds}, etc.). The function \code{\link[=lazy_load]{lazy_load()}} lazy-load objects from |
| 33 |
files saved via \code{\link[=lazy_save]{lazy_save()}}, i.e., a file will not be read until the object |
| 34 |
is used. |
| 35 |
} |
| 36 |
\seealso{ |
| 37 |
\code{\link[=delayedAssign]{delayedAssign()}} |
| 38 |
} |