[R] name of arrays

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Apr 21 17:48:33 CEST 2003



Martin Wegmann wrote:
> 
> Hello,
> 
> I computed acf() and have an array as output. now I would like to have
> only one matrix or data frame (not yet familiar with the nomenclature)
> extracted from this array. or even only the first row of each matrix.
>  the first part of my data "test" is called
> $acf
> ,1
>         , , 1 , , 2
> 1, ,     ...    ...
> 2, ,        ..    ...


It look's different, doesn't it?

$acf
, , 1

              [,1]         [,2]
 [1,] 		...



> I tried several names but nothing wants to work, I only get the message:
> name not recognized.
> 
> any idea? thanks Martin

Since it's an array (obviously inside a list, say L), you can index is
like an array:

L$acf[,,1] # for the first matrix of the third dimension
L$acf[,1,] # for the first matrix of the second dimension
  # in other words: all 1st columns
L$acf[4,,] # for the fourth matrix of the first dimension
  # in other words: all 4th rows

See the manuals for details on indexing arrays.

Uwe Ligges



More information about the R-help mailing list