Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
2701 views
1
#### S-mode session functions.
2
#### assign(..., where=0) makes them last only for the current session.
3
4
#### Well, turns out we have two slightly different versions of the S code.
5
#### This is the one that I think gets used with S-Plus; I'll send along
6
#### the other version as well, but morally they should be equivalent, there
7
#### are just a couple of changes I seem to have made for S4. /John
8
9
### Martin Maechler: see also ./ess-s4.S
10
### which does *not* use assign (why?)
11
assign(".SmodeObs",
12
function(where, pattern) {
13
if(pattern == "") objects(where)
14
else objects(where, pattern)
15
}, where=0)
16
17
assign(".SmodeLoad",
18
function(x)
19
## source function for S-mode
20
{
21
assign(".SmodeTmp", options(error=dump.calls), where=0, i=T)
22
on.exit({options(.SmodeTmp); remove(".SmodeTmp",where=0)})
23
source(x)
24
},
25
where = 0)
26
27
assign(".SmodeDump",
28
function(x, name)
29
## dump function for S-mode
30
{
31
assign(".SmodeTmp", options(error=dump.calls), where=0, i=T)
32
on.exit({options(.SmodeTmp); remove(".SmodeTmp",where=0)})
33
dump(x, file=name)
34
},
35
where = 0)
36
assign(".SmodePaths",
37
function()
38
## the paths for the directories in the search list
39
{
40
temp <- search()
41
value <- character(length(temp))
42
for(i in seq(along.with = temp)) {
43
obj <- database.object(i)
44
if(is.character(obj) && length(obj) == 1)
45
value[[i]] <- obj
46
}
47
value
48
},
49
where = 0)
50
51