s-news
[Top] [All Lists]

guiPlot in functions

To: s-news@lists.biostat.wustl.edu
Subject: guiPlot in functions
From: "W. Bauer" <bauerwo@gmx.net>
Date: Tue, 21 Oct 2003 07:25:32 +0200
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

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