[R] vectorization help please

Bill Simpson wsi at gcal.ac.uk
Wed Sep 26 11:32:11 CEST 2001


> > What is a smarter way of doing:
> > 
> > for(i in 1:xn)
> > for(j in 1:yn)
> > {
> > im2[i,j]<- im[i,j]* (-1)^(i+j)
> > }
> 
> 
>  im * (-1)^(row(im) + col(im))
> 
> Uwe
> 
Thanks very much Uwe.

Bill 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list