Summary Information about S-PLUS Objects

DESCRIPTION:
Returns data class, storage mode, dimension, size and modification date information for S-PLUS objects.

USAGE:
objects.summary(names, what, where=1, frame, pattern, data.class,
      storage.mode, mode="any", all.classes=F, order, reverse=F,
      immediate=T)
print.objects.summary(x, date.format=11, ...)

OPTIONAL ARGUMENTS:
Arguments are divided into those controlling the selection of objects to summarize, those controlling the nature and formatting of the summary information, and others.

Arguments Controlling Object Selection:
The subset of objects from database where or frame number frame which should be selected for summary is specified with either an explicit vector of names, or with some combination of the subsetting criteria pattern, data.class, storage.mode, and mode. If argument names is given, the criteria are ignored. If more than one criterion is given, only objects which satisfy all of them are selected. In the absence of both names and criteria, all objects in where or frame are selected. Detailed descriptions of the arguments follow.

where:
a number or character string identifying a database in the search list, or 0 for the session database. The default is the working database.
frame:
a frame number. If frame is given, where is ignored.
names:
character vector naming objects to summarize.
pattern:
character string specifying a pattern as in grep. Selects objects whose names match the pattern.
data.class:
character vector of data classes. Selects objects belonging to one of the named data classes. If all.classes=T, each element of an object's class attribute is considered, not just the first.
storage.mode:
character vector of storage modes. Selects objects with one of the named storage modes.
mode:
character vector of modes. Selects objects with one of the named modes.

Arguments Controlling Summary Information:
These are used to specify what summary information is desired, and how the entries for the objects should be sorted.

what:
character vector specifying what information to return. This can be any subset of c("data.class", "storage.mode", "extent", "object.size", "dataset.date"), in any order. The default is to return all five types of information, in the order shown. what is subject to partial matching, that is, only enough initial letters of each string element are needed to guarantee unique recognition.
all.classes:
logical flag specifying whether the entire class vector of an object or just the first element should be used, both in selection based on argument data.class and in the returned summary. This has bearing only on objects with a class attribute. By default only the first class element is used.
order:
character vector controlling the sort order of the object entries (printed as rows) in the summary. For example, order="object.size" means sort the objects on the object.size component of the summary. The elements of order can be any subset of the elements of what except "extent"; in addition, "data.class" may not be requested in order if all.classes=T. order is subject to partial matching; thus order="obj" means order="object.size". If length(order) > 1, the second and succeeding elements are used to break ties; see the order function. If order is omitted, the entries are sorted alphabetically by object name.
reverse:
logical flag: if TRUE, the final sort order is reversed, but only if this order depends on something other than object names.

Other Arguments:

immediate:
logical flag: if TRUE, objects in database where are not retained in the expression frame for the duration of the top-level expression (unless they were there already). This flag is TRUE by default to keep memory growth down, though FALSE could improve evaluation time if objects from where will be accessed again during the same top-level expression. See get for details.

Arguments to Print Method:

date.format:
integer specifying in which format the dataset date should be printed. The currently supported values are as with the dataset.date function: 1 for seconds since 1 January 1970 00:00 GMT, 10 for "Tue Sep 29 15:27:15 1992", and 11 for "92.09.29 15:27". The default is the last of these.
...:
other print arguments in name=value form, passed to print.data.frame and beyond.

VALUE:
an object of class "objects.summary", which inherits from class "data.frame". Its components (printed as columns) are those specified in argument what. Each component contains one type of information for all selected objects. They are at most the following.

data.class:
a factor (if all.classes=F), or a list of character vectors (if all.classes=T) containing the data class information. This is defined as in the function data.class, with the exception that when all.classes=T, the summary will contain the entire class attribute for each object which has one, whereas function data.class returns only the first element of this vector.
storage.mode:
a factor giving the storage mode information, as returned by function storage.mode.
extent:
a list, each of whose components is a numeric vector giving the dimension of an object, or its length if it is dimensionless.
object.size:
a numeric vector giving the object sizes in bytes, as defined by function object.size.
dataset.date:
a numeric vector of modification dates; see function dataset.date for a precise definition and caveats. Only objects in directory databases will have nonzero dataset.date values. The dates are always returned as integers (date.format=1) in a summary, though they are typically displayed in a different format by the print method.

SEE ALSO:
objects , data.class , storage.mode , mode , dim, length , object.size , dataset.date , order , grep, get , data.frame , factor , print , print.data.frame .

EXAMPLES:
# Examples demonstrating object selection:
objects.summary()      # all objects on working database
objects.summary("x")   # just x on working database
objects.summary(c("x", "y"), where=2)   # x and y on database 2
objects.summary(where=2, pattern="\\.old$")
     # objects on database 2 whose names end in ".old"
objects.summary(mode="function")
     # only functions on working database; storage.mode ok too
row.names(objects.summary(mode="function"))
     # just char. vector of names of these functions
objects.summary(data.class=c("data.frame", "matrix"))
     # only data frames and matrices on working database
objects.summary(data.class=c("data.frame", "matrix"), all.classes=T)
     # catch objects that inherit from "data.frame" too
objects.summary(data.class="matrix", storage.mode="complex")
     # only complex matrices on working database; i.e, the data
     # class is "matrix" AND the storage mode is "complex"
all.obj <- objects.summary()
mat.index <- all.obj$data.class == "matrix"
cmplx.index <- all.obj$storage.mode == "complex"
all.obj[mat.index | cmplx.index, ]
     # objects with data class "matrix" OR storage mode "complex"
# Examples demonstrating types of summary:
objects.summary()      # all information
objects.summary(what="extent")     # just extent (dim or length)
objects.summary(what=c("ext", "data.cl"))
     # just ext[ent] and data.cl[ass]
objects.summary(order="object.size", reverse=T)
     # all information; sort on object size, biggest first
objects.summary(order="object.size", reverse=T)[1:5, ]
     # five biggest objects
os.date <- objects.summary(order="dataset.date", reverse=T)
     # all info; sort objects on modif'n date, most recent first.
os.date[1:10, ]
     # ten most recently modified objects; all info
os.date[1:10, c("extent", "data.class")]
     # just these two components for those 10; note the component
     # sorted on (earlier) is absent
objects.summary(ord="dataset.date",rev=T)[1:10, c("ext", "data.class")]
     # same thing; note "dataset.date" was implicitly in the what
     # argument so we could sort on it, then abandoned in subsetting
os.date[1:10, "extent", drop=F]
     # just this one component for those 10; need drop=F to preserve
     # data frame structure
objects.summary(order=c("data.class", "object.size"))
     # sort on data class, and object size within data class
# Examples combining argument types:
objects.summary("x", c("data.class", "extent"))
     # these 2 components for x on working database
objects.summary(storage.mode="logical", what="extent")
     # get extent only, for logical data
objects.summary(where=2, mode="function", pattern=
     "...............", what="dataset.date", order="dataset.date")
     # select all functions on database 2 whose names are 15 or more
     # characters long; return dataset date information, sorted
     # on this date with earliest first
# print method
print(objects.summary(what="dataset.date", order="dataset.date"),
     date.format=10)
     # print only names and dataset dates, in the more detailed date
     # format "Thu Oct  1 12:01:30 1992"; objects sorted on
     # dataset date, earliest first