s-news
[Top] [All Lists]

Exchanging Indices of a Matrix

To: <s-news@lists.biostat.wustl.edu>
Subject: Exchanging Indices of a Matrix
From: "Quinn, David" <David.Quinn@nrgenergy.com>
Date: Tue, 25 Jun 2002 12:22:52 -0500
Cc: "Quinn, David" <David.Quinn@nrgenergy.com>
Thread-index: AcIcbO+6Gk3JGvv3RMGKsN2lyuVFgA==
Thread-topic: Exchanging Indices of a Matrix
Is there an easy way to do the following without the looping?  I'm guessing 
not, since I think the internal representation of a matrix is as a list.    -- 
Thanks, David

for (i in 1:x)
{
        for (j in 1:y)
        {
                for (k in 1:z)
                {
                        new.matrix[k,j,i] <- old.matrix[i,j,k]
                }
        }
}


<Prev in Thread] Current Thread [Next in Thread>