Converting your Old Splus Objects

Balasubramanian Narasimhan

$Revision: 1.2 $.
This document describes a simple script that helps users migrate to their old Splus objects to our new servers. While the temptation for automating this process is there, I have deliberately chosen not to do so because of the number of warnings and errors the conversion process could potentially generate. Such warnings and even errors should be heeded by the users, otherwise /em/nasty surprises/ might result.

1. Introduction

On our old servers, our default Splus was version 3.4. Despite the fact that we have always had later versions of Splus, most users relied on the old version.

Now that we are moving to our new servers, the default Splus is version 6.1. Users who rely on Splus have to convert their old objects for use with the new version of the software. I have written a short shell script that might help.

The new Splus works with CHAPTERs. Suppose you have a new empty directory called foo and you wish to store your Splus objects in that directory, you proceed as follows:

[joe@server /home/joe] cd foo
[joe@server /home/joe] Splus CHAPTER

Now you can work as usual in that directory.

1.1 Migrating your objects

Consider the following example. I have a .Data directory in my home directory. I want to convert the objects in that directory. I use a shell script called that I have written.

[joe@server /home/joe] cd
[joe@server /home/joe]
Creating data directory for chapter .
Creating "makefile"
makefile will build with: combo.f
S-PLUS chapter joe initialized.
*                                                        *
* Please see the file Sconvert.log for warnings/errors!  *
* Once, and only when, you are satisfied that none of    *
* the warnings/errors are serious, should you rely on    *
* the converted objects.                                 *
*                                                        *
* Your old .Data directory has been renamed to .OldData. *
* PLEASE delete the old .Data directory to save space    *
* using the command 'rm -rf ./.OldData'                  *
[joe@server /home/joe]

The script tries to be careful by making a backup copy of your .Data directory in .OldData. It is important that you check the file Sconvert.log for warnings and errors. For example, here is an excerpt from that log:

changed "gen.tprod" to replace call to log
changed "z" to record old class "data.frame"

These messages are not serious and so I can afford to ignore them. Others might be serious.

If you are satisfied with the results (you can check this by firing up Splus and listing your objects and functions) then you should delete your old data directory to save space.

1.2 Migrating all objects

The above example showed how to migrate objects in the home directory. One follows the same procedure in every directory where objects have to be migrated. Just change to that directory and run the script.

If you wish to be clever, it is not hard to do this automatically on every directory where Splus objects are present, but it is important to check all the warnings and error messages.

2. Miscellaneous

If you encounter problems, or the conversion revealed problems, then you should delete the newly created .Data directory and rename the .OldData back to .Data.

Then try other approaches or let me know.

I have tried to keep the script simple and yet trap simple errors. For example, the script will detect if you run the script twice in the same directory (without renaming directories), the following message is displayed.

* An old data directory named .OldData exists!           *
* This means that you probably ran this script before    *
* and did not like the results!                          *
*                                                        *
* In that case, you should probably:                     *
*    1) Delete your current .Data directory              *
*       with the command 'rm -rf ./.Data'                *
*       (you didn't like it, right?)                     *
*    2) Rename the .OldData directory to .Data           *
*       with the command 'mv .OldData .Data'             *
*    3) Rerun this script                                *
*                                                        *

If on the other hand, one tries to run the script over an already converted directory, the following message results.

* Sorry, I cannot proceed! It appears that your .Data    *
* directory has already been converted. To avoid the     *
* risk of clobbering your data, please proceed on your   *
* own. Inspect the contents of the script                *
* /home/depot/swtree/lib/local/Splus/convert.S           *
* and run that manually in Splus if you wish. Or do a    *
* GOOGLE search on 'convertOldLibrary' for help.         *