next up previous
Next: On-line Documentation Up: Introduction to S Previous: Beginning an S Session

Recording your S Session

There are several ways to record the work you have done in an S session. If you have a text editor running in another window, you can copy and paste from the Splus window into the editor or word processor. I suggest that you try doing this with pico. To copy text in an Xwindow, simply highlight the desired text by holding down mouse button 1 and dragging the cursor; release the mouse button when the desired section is highlighted. To paste into pico (or elsewhere), you then position the cursor in the pico window, and press mouse button 2.

Using pico is probably the simplest method. Once your work is saved in a text file, you can use pico to edit, add text, and so on. To print a unix file, use the unix enscript command. For example, If your file is called `HW1', you could print it to the printer `draft' with the command

         enscript -Pdraft HW1
The `-P' argument is the name of the printer you wish to use.

Warning: if you use a word processor, it is important to use a fixed width font such as Courier. This will guarantee that information presented in tabular form, and other Splus output will be properly formatted.

You can also record the entire session, that is everything which appears in the terminal window in which you are running Splus. The UNIX script command causes UNIX to save everything that appears in your session window to a file that you specify.

To record your session using the script command, enter `script' at the UNIX prompt followed by a filename. I find it useful to give the script file a descriptive name, either the date (eg. `sept.07') or one derived from the analysis I am working on (eg. `trees.analysis').

REALLY IMPORTANT: Don't forget to terminate the script process after you issue the quit command `q()' in S! To terminate the recording of the script file, just type exit:

% script s.session
Script started, file is s.session
% Splus
S-PLUS : Copyright (c) 1988, 1995 MathSoft, Inc.
S : Copyright AT&T.
Version 3.3 Release 1 for DEC alpha, OSF1 V3.2 : 1995 
> 
.
.
.
> q()
% exit
Script done, file is s.session
% nobs s.session > sept.07
%

The file `s.session' will be a text file. It is helpful to run it through the unix filter nobs (no back space), which removes special characters generated by linefeeds and backspaces. In the example above, the output of the nobs filter is directed to a file `sept.07', which is the cleaned file, ready for editing.


next up previous
Next: On-line Documentation Up: Introduction to S Previous: Beginning an S Session

Albyn Jones
Aug. 30, 1999