s-news
[Top] [All Lists]

[S] variable names into functions

To: s-news@wubios.wustl.edu
Subject: [S] variable names into functions
From: laura vaugeois <lvss490@wadnr.gov>
Date: Wed, 28 Apr 1999 09:44:55 -0700 (PDT)
Reply-to: laura vaugeois <lvss490@wadnr.gov>
Sender: owner-s-news@wubios.wustl.edu
hello all!

i have several matrices of data, all of them need specific functions
run on them.  
each matrix of data is named lsq.<bsn> where the <bsn> is the variable name
of each basin, e.g. lsq.che is the matrix of data from the chehalis basin

what i want to do is to write a function that does the needed processing
where all i have to do is feed the function the suffix (i.e. <bsn>)
so that from the command line i would type:  myfunction(che)
and the function would run on the chehalis dataset.  at present, i've
just been editing the function and changing the name of the <bsn> value,
but surely there is an elegant way to do this!

so, this is my meager attempt at doing this using a plotting function:
in this example, i'm trying to use the 'file' as the variable name
but i get 1) no plot and 2) error message saying that cumareas.file is not found

function(file, filename = deparse(substitute(file)))
{
        plot(cumareas.file, (lsslp.file[, 4] * 1.5), ylim = c(0, 150), type = 
                "b", lty = 1, lwd = 1.5, xlab = "Cum.Area", ylab = "Freq.Pct", 
                pch = "s")
        par(new = T, xaxs = "d", yaxs = "d")
        plot(cumareaq.file, (lsq.file[, 4] * 1.5), xlab = " ", ylab = " ", type
                 = "b", lty = 2, lwd = 1.5, pch = "q")
        text(100000, 100, "file")
}

thank you in advance for your help
lmv

Laura Vaugeois              Natural Resource Scientist/GIS Specialist
WA.DNR, Northwest Region
919 N. Township, Sedro-Woolley, WA  98284 (360) 856-3500 or (360) 902-1425
=============================================================
My interest is in the future because I'm going to spend the
rest of my life there.                     - C.F. Kettering
=============================================================
OPINIONS & ADVICE GIVEN ARE STRICTLY MY OWN AND DO NOT 
REPRESENT THE OPINIONS OF THE WA DNR OR ANY OF ITS OFFICERS.
=============================================================
"Those are my opinions.  If you don't like them, I have others." 
-Groucho Marx



-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] variable names into functions, laura vaugeois <=