R/saveit.R

Defines functions saveit

Documented in saveit

#' Rename objects while saving.
#' 
#' Allows you to rename objects as you save them. See \url{https://stackoverflow.com/a/21248218/654296}.
#'   
#' @param ... Objects to save.
#' @param file Filename/path where data will be saved.
#' 
#' @examples
#' \dontrun{
#' foo <- 1
#' saveit(bar=foo, file="foobar.Rdata")
#' }
#'   
#' @export
saveit <- function(..., file=stop("'file' must be specified")) {
    x <- list(...)
    save(list=names(x), file=file, envir=list2env(x))
}

Try the Tmisc package in your browser

Any scripts or data that you put into this service are public.

Tmisc documentation built on Aug. 23, 2023, 1:07 a.m.