Princeton University Library Princeton University Library

Search DSS





Finding Data Analyzing Data Citing data

About Us


DSS lab consultation schedule
(Monday-Friday)
Sep 1-Oct 16By Zoom appt. here
Oct 19-Dec 4Virtual Zoom Walk-ins
Dec 7-Jan 31By Zoom appt. here
Feb 1-April 30Virtual Zoom Walk-ins
May 3-Aug 31By appt. here
For quick questions email data@princeton.edu.
*No appts. necessary during walk-in hrs.
Note: the DSS lab is open as long as Firestone is open, no appointments necessary to use the lab computers for your own analysis.

Follow DssData on Twitter
See DSS on Facebook

Home Online help Statistical packages S-Plus An Introduction to S-Plus

An Introduction to S-Plus

Overview

S-Plus is an interactive programming environment for data analysis and graphics. It is based on the AT&T Bell Laboratories S program but has substantially greater statistical and graphic capabilities than the original S, particularly in the areas of time series analysis and regression methods.

A wide variety of statistical and data manipulation functions are built into S-Plus. The current version, S-Plus 3.1, includes the statistical modeling capabilities of the 1991 AT&T release of S, as described in the book Statistical Models in S , edited by Chambers and Hastie. Since S is a subset of S-Plus, any S command is an S-Plus command. You can use the S command language to create your own macros.

S-Plus includes graphics commands for dynamic analysis, brush and spin, if you run the program from an X Windows session on a UNIX workstation. Graphics output, including line plots, bar and pie charts, maps, mesh and contour plots, can be saved as PostScript files or displayed on graphic devices. S-Plus also produces output in hpgl for Hewlett Packard and compatible plotters.

The information below refers to the UNIX version of SPlus which is available on the Arizona machines. DSS also supports the PC version (SPlus 2000) which is available on the PCs in the DSS lab. This version is especially useful when you are also using ArcView for GIS applications.

S-Plus and Objects

S-Plus is an object oriented programming language, which simply means that everything in S-Plus is a reusable component called an object. Data, S-Plus functions, and regression output are all considered objects, and the conventions for using S-Plus are consistent accross all types of objects.

This makes S-Plus an extremely flexible programming language, which you can easily modify to do exactly what you want. It also means that it has a somewhat steeper learning curve than many other languages and statistical packages.

Using S-Plus

S objects, whether data or function definitions, are stored in a hierarchical structure. Objects that you create are stored immediately in .Data, the working directory. S-Plus looks first for Data in your current directory. If it is not there, S-Plus uses the .Data directory of your login directory as the working directory. To find an S object, the program searches your .Data directory, then in its own files of functions and example datasets, before assuming it does not exist.

Use the remove (rm ) function to erase unneeded variables while in an S-Plus session, or go to the directory itself and erase items. You can erase the entire .Data directoryif you no longer need it. It will be reinitialized at your next session. You can use the attach function to set up and access .Data in other subdirectories to keep projects separated.

Getting Help

Substantial online help is available with the help command:

     help(function name or operator)
for complete description
     ?function name
     args(function name)

for list of arguments

An indexed help system that can be searched is available if you are running an X Windows session. Two forms of the help window are available. Enter either: help.start(gui="athena") or help.start(gui="motif")

This page last updated on: