Re: [R] Scoping issue?

2007-03-05 Thread jim holtman
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

Re: [R] Scoping issue?

2007-03-05 Thread Luke Tierney
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

[R] Scoping issue? [SUMMARY]

2007-03-05 Thread Thaden, John J
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.

[R] Scoping issue?

2007-03-04 Thread Thaden, John J
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

Re: [R] Scoping issue?

2007-03-04 Thread jim holtman
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

Re: [R] Scoping issue?

2007-03-04 Thread Thaden, John J
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