All objects created during your S-PLUS sessions are stored, in a special form, in the .Data sub-directory of your working directory work, say.
Each object is held as a separate file of the same name and so may be manipulated by the usual UNIX commands such as rm, cp and mv. This means that if you resume your S-PLUS session at a later time, objects created in previous sessions are still available, which is a highly convenient feature.
This also explains why it is recommended that you should use separate working directories for different jobs. Common names for objects are single letter names like x, y and so on, and if two problems share the same .Data sub-directory the objects will become mixed up and you may overwrite one with another.
There is, however, another method of partitioning variables within the same
.Data directory using data frames. These are discussed
further in §
.
In S-PLUS, to get a list of names of the objects currently defined use the command
objects()
whose result is a vector of character strings giving the names.
When S-PLUS looks for an object, it searches in turn through a sequence of places known as the search list. Usually the first entry in the search list is the .Data sub-directory of the current working directory. The names of the places currently on the search list are displayed by the function
search()
The names of the objects held in any place in the search list can be displayed by giving the objects() function an argument. For example
objects(2)
lists the contents of the entity at position 2 of the search list. The search list can contain either data frames and allies, which are themselves internal S-PLUS objects, as well as directories of files which are UNIX objects.
Extra entities can be added to this list with the attach() function and removed with the detach() function, details of which can be found in the manual or the help facility.
To remove objects permanently the function rm is available:
rm(x, y, z, ink, junk, temp, foo, bar)
The function remove() can be used to remove objects with non-standard names. Also the ordinary UNIX facility, rm, may be used to remove the appropriate files in the .Data directory, as mentioned above.