synchronize(database=<<see below>>, meta =<<see below>>)
database
, which database
(ordinary, methods, or documentation) should be synchronized.
If not supplied, all databases are synchronized.
database
.
This takes place immediately, not at completion of the current expression.
database
is given, these (and only these) databases will be
detached and re-attached,
so that their dictionaries reflect any changes made to the external
directory or whatever defines the database.
If
database
is not provided, all databases are flushed, so that
pending assignments, etc. are committed, but the dictionaries are not
revised.
There are two situations in which
synchronize
is needed.
If you are doing a long computation iteratively
and want to ensure that permanent assignments will be
committed now, regardless of any error you may make in the future,
synchronize()
does that.
On the other hand, if you know or suspect that some
otherprocess than your own S-PLUS session may have modified some object that
could be in the keep table (for example, if you edit a function in one
window that you are using in another), then
synchronize(1)
is
needed, in the case that the revised data is on the working database.
To be precise, the second use is only required either to tell the evaluator
that the names of the objects have changed or to update an object, like
a function definition, that will have been saved in the database.
But if you are in doubt and some other process has changed something
on database
n
,
it's wise to
call
synchronize(n)
.
# select datasets to remove, do it now remove.now <- function(now=TRUE) { cat("Type in some datasets to remove:\n") name <- scan(what="") remove(name, where=1) if(now) synchronize() }