.BG
.FN attach
.TL
Attach a New Data Directory
.CS
attach(file, pos=2)
.AG file
character string giving the name of a new data directory to be
accessed.  The name must be a correct UNIX file-system pathname,
specifying an S data directory.
If `file' is omitted, `attach' has no effect on the search list,
but it does return the current value of the search list.
.AG pos
position in data directory search list that `file' should occupy.
The data directories originally in position `pos' or beyond
are moved down the list after `file'.
If `pos=1', `file' will
be attached as the working directory (you must have write permission).
.RT
a character vector giving the previous value of the search list
of directories.
.PP
At the beginning of a session with S,
three data directories are attached: working, system functions
and system data, in that order.
The working directory will be the subdirectory `.Data' of the
current directory; if that does not exist it will be `.Data' in your
home directory; and if that does not exist S will create `.Data' in
your home directory.
.PP
The search list of data directories is valid
only for the current session with S, i.e., it does not
persist across S sessions.
Only directories containing S datasets should be attached as S data directories;
ordinary ASCII data files should be read by the `scan' function.
.SA
See `detach' for removing a data directory from the search list.
.SE
The session object `.Search.list' is a character vector containing
the current list of directories to be searched; this object is changed
in frame 0
as a side effect of `attach'.
.EX
attach("/usr/joe/.Data")  # attach Joe's data directory
attach()  # what is current search list?
.KW data
.WR
