loadws {rwm} | R Documentation |
Loads R workspace and history. Move to workspace directory.
loadws(name = "", d = as.character(.UserDate), silentQ = FALSE, historyQ = TRUE, clearQ = TRUE)
name |
name of workspace. If "", move to directory specified by .UserDirectory<>d |
d |
subdirectory of .UserDirectory, usually year |
silentQ |
TRUE, no message |
historyQ |
TRUE, load R history |
clearQ |
TRUE, clear all R objects before loading the workspace |
This simply uses `load(...)` and `loadhistory(...)` to load the R workspace and command history specified by the arguments. Normally all R objects are removed using 'clearws(silent=TRUE)' before loading the workspace.
The working directory is set the the workspace working directory unless `name` is the null string. In this case, the current directory is set to `.UserDirectory`<>`d`.
An error message is given if `.UserDirectory` is not defined. The `.UserDirectory` may be set manually using a normal R assignment or by the function InitializeRWM().
The global variable `.WSID` is set to the current working directory.
In the unlikely event that the workspace being loaded already happens to contain one of the objects 'loadws', 'savews', 'clearws' or 'continuews', you will be prompted to remove it. An error is generated if you don't remove it.
To save this workspace back where it was use `savews()`.
If the workspace contains a character vector `.Describe`, this is also displayed when the workspace is loaded. `.Describe` may contain a brief description of the purpose of the workspace and/or major functions/datasets in the workspace.
A.I. McLeod
McLeod, A.I. (2008). R Workspace Management: With R Package.
load
,
savews
,
clearws
,
InitializeRWM
## Not run: #Example 1. #Test if setup is ok TestRWMSetup() #define a new function is.same.name<-function(x,y) is.logical(all.equal(x,y))&&all.equal(x,y) #save this workspace as SameName savews("SameName") #check .WSID .WSID #also save R source file in workspace directory dump("is.name.same", file="is.name.same.R") #see all objects in directory dir() ## End(Not run)