get(name, where=<<see below>>, ...) get.default(name, where=<<see below>>, frame=<<see below>>, mode="any", inherit=F, immediate=F) exists(name, where=<<see below>>, ...) exists.default(name, where=<<see below>>, frame=<<see below>>, mode="any", inherit=F)
It is an error to supply both where and frame.
exists returns TRUE or FALSE according to whether the search succeeds.
If both where and frame are omitted, the search is done as if name were an ordinary name in an expression. That is, the search is first in the local data frame, then in frame 1, then the session frame, and then in each of the permanent directories in the search list.
If where is an explicit database rather than a position in the search list, and if the type of the database is known, an alternative is to call the appropriate dbread method directly. Most commonly, this will be a call to dbread.default() for access to a standard S-PLUS directory of binary-object files. The advantage of dbread in this case is that the entire database need not be attached, so the directory need not be read in.
Finding an object with exists that fails the mode test returns FALSE and produces a warning message if the search otherwise succeeds. Finding a file name that does not contain an S-PLUS object produces a warning message and returns FALSE.
You can not use get("a$b") to get the b component of object a; rather this will attempt to get an object named "a$b". Use get("a")$b to get the b component of a.
The use of get with a path name is a more efficient way to get a few objects from a known directory than using attach.
get("[[") # get or print an object of a non-standard name get("abc", mode="function") # get abc, but only if it is a function joe.x <- get("x", w="/usr/joe/.Data") # get joe's version of x if(!exists("my.init", frame=0)) # look only in session database do.initialize()# arrange to read a lot of objects from two databases, and check for # equality, without cluttering up the top-level expression. Calling # do.compare in a loop works better than doing the get's at top level
do.compare <- function(name,i,j) all.equal(get(name, w=i, immediate=T), get(name, w=j, immediate=T))