s-news
[Top] [All Lists]

guiPlot within a function

To: <s-news@lists.biostat.wustl.edu>
Subject: guiPlot within a function
From: "Huso, Manuela" <manuela.huso@oregonstate.edu>
Date: Wed, 10 Nov 2004 16:04:22 -0800
Thread-index: AcTHggAjHUbxM2MXQbWIDZNCXcEl9w==
Thread-topic: guiPlot within a function

Hello,

 

I need to make many plots of different data sets with similar structure.  I want to pass the dataset name to the guiPlot function within my function.  Here is a simple case:

 

I have several data frames similar to biasR10, differing only in the biasa value:

> biasR10

    decline demise detection  biasa

 1   StepUp     25       0.1  0.015

 2   FullUp     25       0.1  0.013

 3   Flat50     25       0.1  0.004

 4    Flat0     25       0.1  0.015

 5 FullDown     25       0.1  0.004

 6 StepDown     25       0.1  0.000

 7   StepUp     25       0.5  0.057

 8   FullUp     25       0.5  0.045

 9   Flat50     25       0.5  0.004

10    Flat0     25       0.5  0.057

11 FullDown     25       0.5  0.004

12 StepDown     25       0.5  0.000

13   StepUp     25       0.8  0.073

14   FullUp     25       0.8  0.055

15   Flat50     25       0.8 -0.011

16    Flat0     25       0.8  0.073

17 FullDown     25       0.8 -0.004

18 StepDown     25       0.8  0.000

19   StepUp     50       0.1  0.024

20   FullUp     50       0.1  0.001

21   Flat50     50       0.1 -0.020

22    Flat0     50       0.1  0.005

23 FullDown     50       0.1 -0.022

24 StepDown     50       0.1 -0.019

25   StepUp     50       0.5  0.079

26   FullUp     50       0.5 -0.002

27   Flat50     50       0.5 -0.094

28    Flat0     50       0.5  0.012

29 FullDown     50       0.5 -0.107

30 StepDown     50       0.5 -0.067

31   StepUp     50       0.8  0.095

32   FullUp     50       0.8 -0.006

33   Flat50     50       0.8 -0.138

34    Flat0     50       0.8  0.014

35 FullDown     50       0.8 -0.150

36 StepDown     50       0.8 -0.081

 

When I run the following code, it works fine.

guiPlot( PlotType = "Bar Zero Base", DataSet = "biasR10", Columns = "decline,biasa") guiModify( "Graph2D", Name = "GS1$1", PanelType = "Condition",

     ConditionColumns = "demise,detection", TrellisConditionDS = "biasR10")

 

But I would like to imbed this code in a function (so I can do many plots quickly) and pass the data set, the columns and the conditioning columns as arguments.  I am stumped as to the syntax needed to recognize character variables, and so am asking your help.

 

I tried just the first part (with no conditioning) with many variations on the theme using as.character, reassigning dataset within the function, etc.  I tried Krause and Olson's suggestion for "Using function arguments in graphics labels" using the deparse(substitute(x)) but apparently incorrectly.  I have looked in the programmer's guide but not found what I need, although I imagine it is there somewhere :-)

 

So, I am appealing to you all.  Many thanks in advance for this remedial help.

 

Manuela

 

 

 

><><><><><><><><><><><><

Manuela Huso

Consulting Statistician

Department of Forest Science

201H Richardson Hall

Oregon State University

Corvallis, OR   97331

ph: 541.737.6232

fx: 541.737.1393

 

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