s-news
[Top] [All Lists]

Re: guiPlot in functions

To: "W. Bauer" <bauerwo@gmx.net>
Subject: Re: guiPlot in functions
From: Spencer Graves <spencer.graves@pdf.com>
Date: Tue, 21 Oct 2003 02:01:30 -0700
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <3F94DF6C.23907.70715BC@localhost>
References: <3F94DF6C.23907.70715BC@localhost>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
I just noticed that your A2 combines an the first column of A1 with an object A that I don't find in your email. Might this be the problem? Another problem with your question is that the documentation on "guiPlot" is quite limited. If Insightful had used standard S-language commands in their Graphical User Interface (gui), then there would be substantially more documentation available on the commands, and people would use the gui much more. I would do something like this as follows (which I just tested in S-Plus 6.1 for Windows):
myplot <- function(entry)
   plot(entry[,1], 5*entry[,2])
A1 <- data.frame(matrix(1:8, 4, 2)) myplot(A1)

A2 <- data.frame(A1[1], -A1[2])
myplot(A2)
hope this helps. spencer graves

W. Bauer wrote:

Dear all

I guess my previous mail was too confused, so here another try:

I would like to plot in a function the results of calculations, using guiPlot, in the following way:

"myplot" = function(entry) {
        sub.data.frame<-data.frame(entry[1],5*entry[2])
        assign("myplot.data.frame",sub.data.frame,where=0)
        guiPlot("Line",DataSet="myplot.data.frame",Columns="1,2")
        remove("myplot.data.frame",where=0)
}

I use the assign(,where=0) because otherwise guiPlot does not find myplot.data.frame. This function works fine the first time it is used, e.g. for A1<-data.frame(matrix(1:8,4,2))
   myplot(A1)
But from the second call on, the plot is completely messed up, e.g.
   A2<-data.frame(A1[1],-A[2])
   myplot(A2)

I suppose this is related to using proper frames/databases to store the data in. What is the correct way?

Many thanks, Wolfgang Bauer
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news


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