Everyone is being too complicated.
c( A[1,2] , A[3,3] )
will do what you ask.
A <- matrix(seq(1,9),nrow=3)
c( A[1,2] , A[3,3] )
[1] 4 9
But I would assume you have some more general
problem in mind, and I do not know if this simple
approach will meet those needs.
-Don
At 3:26 PM
On Mar 12, 2010, at 2:31 PM, David Winsemius wrote:
On Mar 12, 2010, at 9:26 AM, Nils Rüfenacht wrote:
Dear all!
I'm trying to get multiple values from a matrix by using a single
command.
Given a matrix A
A <- matrix(seq(1,9),nrow=3,ncol=3)
How can I get e.g. the values A[1,2] = 4 and
On Mar 12, 2010, at 9:26 AM, Nils Rüfenacht wrote:
Dear all!
I'm trying to get multiple values from a matrix by using a single
command.
Given a matrix A
A <- matrix(seq(1,9),nrow=3,ncol=3)
How can I get e.g. the values A[1,2] = 4 and A[3,3] = 9 with a
single command and without using a
Try this:
diag(A[c(1,3),c(2,3)])
2010/3/12 Nils Rüfenacht :
> Dear all!
>
> I'm trying to get multiple values from a matrix by using a single command.
>
> Given a matrix A
>
> A <- matrix(seq(1,9),nrow=3,ncol=3)
>
> How can I get e.g. the values A[1,2] = 4 and A[3,3] = 9 with a single
> command
use a matrix of n x 2 to index. For details: sec. 5.3 "Index matrices" in the
introduction.
HTH Claudia
Nils Rüfenacht wrote:
Dear all!
I'm trying to get multiple values from a matrix by using a single command.
Given a matrix A
A <- matrix(seq(1,9),nrow=3,ncol=3)
How can I get e.g. the val
5 matches
Mail list logo