Working With S-PLUS

Working With S-PLUS

Information provided in this section describes basic activities that you perform in the S-PLUS 7 statistical application as it is implemented in the RCE.

S-PLUS is an S language tool that is useful for the graphical and statistical analysis of data. The version of S-PLUS 7 installed in the RCE is the Enterprise Developer tool, which includes the S-PLUS Workbench and the Big Data library. The Big Data library provides objects, classes, and functions for use with large data sets.

In S-PLUS, a library is a directory that must contain a .Data directory and can contain other objects, commands, functions, scripts, and files.

This section describes basic activities that you perform in the S-PLUS statistical application as it is implemented in the RCE. It includes information about how to perform the following:

  • Launch and exit from the menus and from the command prompt
  • Access help
  • Install new components

See Implementation Details for general information about the implementation of S-PLUS in the RCE, including where to find out more about the tool.

For information about how to access the RCE, refer to Connecting to the RCE Summer 2009.

Launching and Exiting S-PLUS

Launching and Exiting S-PLUS

You can launch S-PLUS in the RCE by using the menus or by typing a command.

Launching S-PLUS

To launch S-PLUS by using the menus in the RCE, select the Applications menu Mathematics submenu, and then choose S-PLUS to launch the tool.

To launch S-PLUS from the CLI, use one of the options described in the following table.

S-PLUS Launch Commands

To start this version

Type this command

S-PLUS CLI

Splus

S-PLUS CLI with Java support

Splus -j

S-PLUS CLI with the Big Data library

Splus -bigdata

S-PLUS GUI

Splus -g

S-PLUS Workbench GUI

Splus -w or Splus -workbench

You can include the following options on the command line:

  • Include the & command to run the tool in the background and keep your terminal window open for other uses.

  • For the GUI tool, include the -helpoff option to turn off automatic start up of the help system. The help system consumes significant memory resources.

  • You can combine the -bigdata and -w options to launch the Workbench GUI and the Big Data library together.

Exiting S-PLUS

To exit the S-PLUS GUI tool, choose the File menu Exit option.

To exit the S-PLUS CLI tool, type q() in the application window.

Accessing Built-in Help in S-PLUS

Accessing Built-in Help in S-PLUS

This section describes how to access Help in the S-PLUS GUI and CLI.

A full set of S-PLUS documentation PDFs are located in the following directory:

/usr/local/splus/7.0/doc/

Accessing Help in the S-PLUS GUI

To access the built-in Help system in the S-PLUS GUI, select the Help menu and then choose an option. A separate window opens and the Help content is displayed.

Accessing Help in the S-PLUS CLI

To launch the GUI Help window from the command line, type the command help.start(). S-PLUS opens a separate window and the Help content is displayed.

To launch the command-line Help, type the command help(<function>). The window changes to list the Help content.

To move down a page, press the Space bar.

To move up a page, press Ctrl+b.

To exit the Help function and return to the S-PLUS command line, type q.

Listing and Installing Data Sets and Libraries in S-PLUS

Listing and Installing Data Sets and Libraries in S-PLUS

S-PLUS supports numerous types of data sets and libraries.

Listing S-PLUS Objects and Data

Listing S-PLUS Objects and Data

You can view a list of objects, including data sets, available in your S-PLUS working database. The contents of your working database are the files stored in the following directory:

/nfs/fs1/home/<First Initial>/<login account username>/MySwork/.Data/

To view the contents of your working database from the GUI tool, choose the View menu Object Summary Window option. The Objects Summary Window lists all data sets installed in your working database.

To view the contents of a data set:

  1. Choose the View menu New Data Viewer option.

    The New Data Viewer window opens.

  2. Use the Data Set pull-down menu to select the data set for which you choose to view contents, and then click OK.

    The Data Viewer window opens. You can scroll through the contents of the data set in this window.

To view the contents of your working database from the CLI:

  1. Change to the ~/MySwork/.Data directory.

    In your home directory, type cd ~/MySwork/.Data/.

  2. Type ls to view the objects in your working database.

    A list of objects is displayed, including all data sets.

An example is:

rce-2:<login account username> [~/MySwork/.Data]> ls
__bdo Census __Hhelp last.warning __Meta ___nonfile Readme __Shelpr
Installing S-PLUS Data Sets

Installing S-PLUS Data Sets

To import a new S-PLUS data set to your working database:

  1. In S-PLUS, select the File menu Import Data option.

    The Import Data window opens.

  2. Click the Browse button.

    The Select File window opens.

  3. Navigate to the location of your new data file, select that file, and then click OK.

    The Import Data window lists your selected file in the File Name field.

  4. Use the File Format pull-down menu and select the type of file that you choose to import.

  5. Enter a name for this data set in the Data Set Name panel Save As field.

  6. To import this data set and exit the Import function, click OK.

    To continue importing data sets, click Apply.

    The Report window is displayed, which lists results of the data import.

Installing (Attaching) S-PLUS Libraries

Installing (Attaching) S-PLUS Libraries

To install a new library on your local system, copy your new library directory into the S-PLUS installation's /library directory. Then, make the new library available for use (that is, attach it) by typing the following command in S-PLUS:

> library(<libraryname>)

You also can attach a library that resides in another location by specifying that location when you attach the library. Type the following command:

> library(<libraryname>, lib.loc="<librarypath>")
Locating S-PLUS Directories

Locating S-PLUS Directories

S-PLUS is installed in the following directory:

/usr/local/splus/7.0/

When you launch S-PLUS, the following message is displayed in the application window:

Working data will be in /nfs/fs1/home/<First Initial>/<login account username>/MySwork

This message identifies the default location of all input, output, and saved files for use in S-PLUS.

IQSS