Skip to content
Prev 312937 / 398503 Next

Large loops in R

Without a reproducible example it's hard to tell for certain, but what
about simply (assuming nrows2 is actually columns):

sum((mat1/d1 - mat2/d2)^2)

R is smart enough to understand elementwise manipulation of a matrix:
you shouldn't need a loop at all.

Sarah

On Tue, Dec 4, 2012 at 2:27 PM, Charles Novaes de Santana
<charles.santana at gmail.com> wrote:
--
Sarah Goslee
http://www.functionaldiversity.org