R/load.session.R

load.session <- function(name) {
  .base <- "Saved_R_Sessions/"
  .full.path <- paste(.base, name,
                      "/", name,
                      ".RSession", sep="")
  ## #Basic comment for a #Basic man
  if (!dir.exists(.full.path)) {
    stop("No session exists")
  }
  ## now call the function that does the heavy lifting
  session::restore.session(file = .full.path)
}

#' @title Load a Previously Saved Session
#'
#' @name load.session
#'
#' @description Given a string \code{name}, the function will load a previously
#'  saved R ression saved by \code{save.session}. The session will be located in
#'  ~/Saved_R_Sessions/\code{name}.
#'
#' @param \code{name} A string value naming the session you wish to load.
#'
#' @return Load environmental variables and namespaces from the named session
#'
#' @seealso \link{session}[Session Package].
#'
#' @details No saved session exist with the given \code{name}, the function will
#'   raise an error.
#'
#' @keywords load, sessions, shiny, CMU
#'
#' @export
"load.session"
frank113/CMU-Shiny-Server documentation built on May 29, 2019, 12:23 p.m.