s-news
[Top] [All Lists]

Re: organize objects in a chapter

To: <s-news@lists.biostat.wustl.edu>
Subject: Re: organize objects in a chapter
From: "Chuck Taylor" <chuck@insightful.com>
Date: Fri, 17 Feb 2006 13:06:15 -0800
Thread-index: AcYzsbD5bgjCyXNERT6HxU96PBnG1AAU3H1g
Thread-topic: [S] organize objects in a chapter
A few comments here that you may find helpful:

1. You should never try to move S-PLUS objects into or out 
of a chapter using Windows Explorer or other tools outside 
of S-PLUS. Doing so would disrupt the way S-PLUS keeps track 
of its objects.

2. The best way to group objects is to put them in separate 
chapters.

3. To access objects in other than your working chapter, use 
attach() to add it to your search path.

For example, suppose you have a group of utility functions 
that you wish to keep together. Create a new chapter called 
"Utilities". Suppose you put it in "D:\Data". You could do 
something like this:

   createChapter("D:/Data/Utilities")
   attach("D:/Data/Utilities", pos=2)

To see what has happened, run search().

Then you could move functions into that directory using 
commands such as this:

   assign("MySum", MySum, where=2)

What that does is to get MySum from the chapter in position 1 
of your searchpath (your working chapter) and assign it to the 
chapter in position 2 ("Utilities"). The following does the 
same thing, but is more explicit about where MySum is from:

   assign("MySum", get("MySum", where=1), where=2)

If you would like to attach the utilities directory every 
time you run S-PLUS, create this function in each of your 
working chapters:

   .First <- function(){
      attach("D:/Data/Utilities", pos=2)
   }

Chuck Taylor
Sr. Quality Assurance Engineer
Insightful Corporation
Seattle, WA, USA

-----Original Message-----
From: Sichong Chen [mailto:sichong.chen@postgrad.manchester.ac.uk]
Sent: Friday, February 17, 2006 3:03 AM
To: s-news@lists.biostat.wustl.edu
Subject: [S] organize objects in a chapter


Dear users
I have two dumb questions about organize objects in my working chapter.

In my working chapter, now I have about two hundred objects. I tried to
create some folders in the chapter so that I can locate my object quickly.
After I create a new folder in the chapter and move the objects to the
folder, I click "save" button when I exit SPlus. But next time when I start
SPlus. The folder is empty. There is no object in this folder all are in the
chapter's directory. How do you organize objects when there are hundreds
objects in the working chapter?

Another questions is how do you important a object in another working chapter
to my current working chapter? (When I start a new project, I create a new
working chapter. Is it right?) I tried to use attach function but when I
attach to another working chapter, it seems that I have detached my current
working chapter. I can not do with the objects I am currently managing. How
do you handle this problem?

Many thanks.

CSC

SPlus 7.0 & FinMetrics 2.0 User
Windows XP

<Prev in Thread] Current Thread [Next in Thread>