book
Article ID: KB0080392
calendar_today
Updated On:
Description
User is getting unexpected results from function called within TIBCO Spotfire S+
Issue/Introduction
Masked Object or Corrupt .Prefs and/or .Data writeup
Environment
Product: TIBCO Spotfire S+
Version: All supported versions
OS: Window
--------------------
Resolution
First, check to see that you have not masked any objects in your session that S-PLUS might be trying to call. You can do this by typing 'masked()' at the command line. Any S-PLUS objects, including functions, that have been overwritten will appear.
This will read character(0) if there are no masked objects. Any objects that are masked, even if they don't appear directly within the problem function, should be deleted or renamed. Below is an example of a commonly masked function and how to rename and delete it.
> masked()
character(0)
> c
function(..., recursive = F)
.Internal(c(..., recursive = recursive), "S_unlist", T, 1)
> c <- 1:5
> c
[1] 1 2 3 4 5
> masked()
[1] "c"
> c.new <- c
> c.new
[1] 1 2 3 4 5
> rm(c)
> masked()
character(0)
> c
function(..., recursive = F)
.Internal(c(..., recursive = recursive), "S_unlist", T, 1)
If this does not help, it might be possible that you have a corrupt .Prefs or .Data directory.
Check to see if your .prefs directory is corrupt:
With S-PLUS closed, delete your .prefs directory, the default location is:
c:\Program Files\Insightful\splus70\users\<login name>\.prefs
This directory stores your user preferences, such as graph colors, default options, etc. When you restart S-PLUS, the defaults will be restored in this directory. When restarting S-PLUS you will receive a message that .data and/or .prefs cannot be found. Click OK to create the default. Just the default .prefs will be created.
If this still does not help, your .data directory may be corrupt. Please try the following:
Start S-PLUS in a *NEW* project directory by defining the S_PROJ environment variable. S_PROJ defines your working .data, .prefs and current working directory. For example, create the new 'c:\TestProj' directory with nothing in it. Define your S_PROJ variable, at the end of your 'Target' line in your S-PLUS 7 icon's shortcut properties. To do this, select your icon, right-click, and select 'Properties' from the contextual menu that opens. Under the shortcut tab, add your S_PROJ definition at the end of the 'Target:' field. For example,
Target: "C:\Program Files\Insightful\splus70\cmd\splus.exe" S_PROJ=c:\TestProj
specifies to start S-PLUS in the c:\TestProj project directory.
Click 'OK' and execute S-PLUS from this icon. If the problem persists, then your .data directory was not corrupt.
If the .data directory was corrupt, you will now need to do a data.dump() of your original .data contents into the new .data directory:
1). Start S-PLUS in the newly created S_PROJ directory.
2). Use 'attach()' from the S-PLUS command line to attach the old .data directory in position 2 of your S-PLUS search path:
> attach("C:\\Program Files\\Insightful\\splus70\\users\\<username>")
You can also attach the old .data directory by selecting: File -> Chapters -> Attach/Create Chapter:
Chapter Folder: C:\Program Files\Insightful\splus70\users\<username>
Label: <username>
Position: 2
3). Use data.dump() on the objects in your original .data directory by typing:
> data.dump(objects(where=2),"c:\\myfile.dmp", where=2)
to save your old objects into a formatted text file that S-PLUS can interpret. The 'data.dump' file should no longer contain the corrupted files/data.
4). Use data.restore() on your data.dump file:
> data.restore("c:\\myfile.dmp")
to restore the old objects in the new working chapter's .data directory.
5). Use 'detach()' from the command line to detach the corrupt .data directory from position 2 of your search path:
> detach(2)
You can also detach the corrupt .data directory by selecting: File -> Chapters -> Detach Chapter.