s-news
[Top] [All Lists]

Re: guiPlot in functions

To: Spencer Graves <spencer.graves@pdf.com>
Subject: Re: guiPlot in functions
From: "David L Lorenz" <lorenz@usgs.gov>
Date: Tue, 21 Oct 2003 07:31:25 -0500
Cc: bauerwo@gmx.net, s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
Wolfgang,
  I suggest the use of DataSetValues in this case. You do not need to
assign or remove the data set because the DataSetValues options embeds the
data.  Your function call should look like:

guiPlot("Line",DataSetValues=myplot.data.frame[,c(1,2)])

Dave


                                                                                
                                                                   
                      Spencer Graves                                            
                                                                   
                      <spencer.graves@pdf.com>         To:       "W. Bauer" 
<bauerwo@gmx.net>                                                      
                      Sent by:                         cc:       
s-news@lists.biostat.wustl.edu                                                  
  
                      s-news-owner@lists.biosta        Subject:  Re: [S] 
guiPlot in functions                                                      
                      t.wustl.edu                                               
                                                                   
                                                                                
                                                                   
                                                                                
                                                                   
                      10/21/03 04:01                                            
                                                                   
                                                                                
                                                                   
                                                                                
                                                                   




      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
>
>

--------------------------------------------------------------------
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>