Objects: List objects in object caches.

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

These functions may be used to find stored object caches on the search path and list the objectes stored in them. If the object cache is currently not on the search path it is silently attached at position 2.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Objects(lib = Sys.getenv("R_LOCAL_CACHE", unset = ".R_Cache"),
        lib.loc = Sys.getenv("R_LOCAL_LIB_LOC", unset = "."),
        all.names = FALSE, pattern = ".*", readonly = FALSE)
ObjectsData(...)
ObjectsUtils(...)
Ls(lib = Sys.getenv("R_LOCAL_CACHE", unset = ".R_Cache"),
        lib.loc = Sys.getenv("R_LOCAL_LIB_LOC", unset = "."),
        all.names = FALSE, pattern = ".*", readonly = FALSE)
LsData(...)
LsUtils(...)

Arguments

lib

The name of the cache directory from which items are to be removed. May be given as a character string, or as a name, (i.e. without quotes) for convenience. The default is as follows:

  • For Objects, the value of the R environment variable R_LOCAL_CACHE, or .R_Cache if unset,

  • For ObjectsData, the value of the R environment variable R_CENTRAL_DATA, or .R_Data if unset,

  • For ObjectsUtils, the value of the R environment variable R_CENTRAL_UTILS, or .R_Utils if unset.

lib.loc

The enclosing directory where the cache directory is to be found. The default is as follows:

  • For Objects, the value of the R environment variable R_LOCAL_LIB_LOC, or the current working directory if unset,

  • For ObjectsDate and ObjectsUtils the value of the R environment variable R_CENTRAL_LIB_LOC, or he user's HOME directory if unset.

all.names

Logical. Should all names be listed? Normally objects with names beginning with a period are not listed.

pattern

Regular expression giving the pattern of object names to be listed.

readonly

If the stored object cache is not present on the search path, it is silently attached at position 2. Should it be attached as ‘read only’?

...

Dummy argument to allow any of the above to be specified.

Details

These convenience functions provide the same functionality as the standard function objects, or equivalently ls, but specialised to stored object caches. They automatically locate caches on the search path and, optionally, attach them if not currently present.

Value

A character string vector of object names.

Note

The standard functions objects or ls may always be used on stored object caches, but require the position on the search path to be specified.

Author(s)

Bill Venables

References

None

See Also

objects, ls.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## change default cache, keeping any previous setting
oldLC <- Sys.getenv("R_LOCAL_CACHE", unset = ".R_Cache")
Sys.setenv(R_LOCAL_CACHE=".R_Test")

## generate some dummy data
dummy <- rnorm(100)
mn <- mean(dummy)
va <- var(dummy)

## store it in the stored object cache
Store(dummy, mn, va)
Search()
Objects()
Remove(mn, va)
Objects()
Remove(Objects())                   # empty the cache
detach(".R_Test")                   # remove from search path
Sys.setenv(R_LOCAL_CACHE=oldLC)     # restore normal default

Example output

   name              lib.loc                      
01 .GlobalEnv                                     
02 .R_Test           .                            
03 package:SOAR      /usr/local/lib/R/site-library
04 package:stats     R_HOME/library               
05 package:graphics  R_HOME/library               
06 package:grDevices R_HOME/library               
07 package:utils     R_HOME/library               
08 package:datasets  R_HOME/library               
09 package:methods   R_HOME/library               
10 Autoloads                                      
11 package:base      R_HOME/library               
Warning message:
In normalizePath("~", winslash = "/") :
  path[1]="/home/anon": No such file or directory
[1] "dummy" "mn"    "va"   
[1] "dummy"

SOAR documentation built on May 2, 2019, 6:34 a.m.