[R] How to define new matrix based on an elementary row oper
David Winsemius
dwinsemius at comcast.net
Sat Aug 28 18:20:35 CEST 2010
On Aug 28, 2010, at 11:32 AM, Cuckovic Paik wrote:
>
> Thank you very much, David;
> for row swapping: R2<==>R3
>
>> A=diag(1:4)
>> A
> [,1] [,2] [,3] [,4]
> [1,] 1 0 0 0
> [2,] 0 2 0 0
> [3,] 0 0 3 0
> [4,] 0 0 0 4
>> A1=A[c(1,3,2,4),]
>> A1
> [,1] [,2] [,3] [,4]
> [1,] 1 0 0 0
> [2,] 0 0 3 0
> [3,] 0 2 0 0
> [4,] 0 0 0 4
Yes, obviously. My point was illustration of construction of
equivalent matrix operators (which was what I assumed was the
educational goal motivating your insistence on a one step process for
a translation operation, but maybe your goal was merely compact code.)
The manipulation of indices does not generalize to rotations very
well, either.
--
David.
More information about the R-help
mailing list