savews {rwm}R Documentation

Save workspace

Description

Save R workspace and history.

Usage

savews(name = .WSID, d = as.character(.UserDate), silentQ = FALSE, historyQ = TRUE)

Arguments

name name of workspace
d usually year but could be any other part
silentQ TRUE, no message
historyQ TRUE, save R history

Details

First the working directory is changed to that specified by the arguments. The working directory is specified by concatenating `.UserDirectory`<>`d`<>`name` unless `name` is set to its default `.WSID`. In this case the working directory is simply `.WSID`. Then `save.image(".Rdata")` and `savehistory(".Rhistory")` are used. The global variable `.WSID` is set to the working directory.

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 `IntializeRWM()`.

Value

Just before saving, the following is done: (i) the global variable `.WSID` is set to the working directory for the saved workspace and (ii) the global variable `.UserDate` is set.

Note

`savews()` is a useful shortcut. It saves the current workspace in exactly the same file it was in when loaded.

Author(s)

A.I. McLeod

References

McLeod, A.I. (2008). R Workspace Management: With R Package.

See Also

load, savews, clearws, InitializeRWM

Examples

## Not run: 
#Example 1.
#load a previously saved workspaced in current year
savews("myws")

#Example 2.
#load a previously saved workspaced from 2005
savews("ktest", d=2005)
#...make some changes... and then re-save
savews()
## End(Not run)


[Package rwm version 1.27 Index]