Skip to content

load workspace by function

2 messages · Julio Oliveira, Noia Raindrops

#
Dear,

I would like load a saved workspace (file .Rdata) by function.

Example:

load_workspace <- function ()
{
 workspace_name <<- (tk_choose.files(default = "", caption = "Select the Workspace file (.Rdata) ")
  load(workspace_name) 
}

But, when finish the function (load_workspace) the files of the .Rdata are deleted.

Area there any command for return the files?

Thanks.

Julio
#
Hello,

Add 'envir' arugment:

load(workspace_name, envir = globalenv())

# or
load(workspace_name, envir = parent.frame())