Hi,

I have the following problem:

I want to redefine the for loop (or define a similar statement) to change its 
behavior under some circumstances. So, I would like sthg. like

"For" = function ( var, vec, statement ) {
 
  if ( ... ) {
    /* my implementation of for */
  }
  else {
    /* call R's for loop */
  }
}

I tried to manipulate the elements of the list one gets by

e = quote( for ( i in (1:10) ) print("*") )

That means, storing the variable in e[[2]] (my trials didn't work), and the 
statement in e[[4]], but I failed.

How can one do this in R? It would be best, if I could redefine "for" directly, 
so that one can use the same syntax, i.e., with the statement after the 
function call.

Can somebody help me?


Thanks!







{
-- 

Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to