It is not really an argument to mmatplot; it is an argument to mapply and I
am not certain what might be happening in there with respect to lazy
evaluation. Yes you can set it up with lapply, but I don't think speed is a
concern since most of the time is being spent in the matplot routine. If
In your test function there is no lexically visible definition for the
`colnum` variable used in defining main, so that error is what you
expect from lexical scoping. Lazy evaluation dictates when (and if)
the `main` argument is evaluated, but the environment in which it is
evaluated is
A BIG thanks to Luke Tierney and Jim Holtman (and perhaps others? I haven't
seen the latest digest) for pointing out two fixes to some code that was
troubling me. I since found a third problem, and with that, have good code.
Their comments are summarized below this fixed version of the code.
Hello, The code below is supposed to be a wrapper for matplot to
do columnwise visible comparison of several matrices, but I'm
doing something wrong because I can't access an argument called
'colnum'. I'd be most grateful for some insight.
Thanks,
John Thaden
Little Rock, AR
First of all, 'colnum' does not exist when the 'paste' is called. This
probably does what you want:
for (colnum in 1:ncol(A)){
mmatplot(colnum, 1:nrow(A), A, main=paste(Array input, column,
colnum))
}
On 3/4/07, Thaden, John J [EMAIL PROTECTED] wrote:
Hello, The code below is supposed
Apparently you're right that colnum doesn't exist when it needs to
be evaluated, but why? Why is 'paste' being evaluated so early? It is,
after all, the value of an argument ('main') of my mmatplot function
with colnum being another argument. I thought arguments were lazy-loaded.
Does using