Skip to content
Prev 269779 / 398502 Next

Selections in lists

On Aug 25, 2011, at 11:24 AM, mdvaan wrote:

            
I suspect this is because you g object does not have the structure  
that you imagine for it:

 > str(g)
List of 3
  $ 1997: num [1:4, 1:4] 3 2 1 1 2 3 0 1 1 0 ...
   ..- attr(*, "dimnames")=List of 2
   .. ..$ B: chr [1:4] "8025" "8026" "8027" "8029"
   .. ..$ B: chr [1:4] "8025" "8026" "8027" "8029"
  $ 1998: num [1:4, 1:4] 2 1 1 0 1 3 1 1 1 1 ...
   ..- attr(*, "dimnames")=List of 2
   .. ..$ B: chr [1:4] "8025" "8026" "8027" "8029"
   .. ..$ B: chr [1:4] "8025" "8026" "8027" "8029"
  $ 1999: num [1:5, 1:5] 2 1 1 0 0 1 3 2 0 1 ...
   ..- attr(*, "dimnames")=List of 2
   .. ..$ B: chr [1:5] "8025" "8026" "8027" "8028" ...
   .. ..$ B: chr [1:5] "8025" "8026" "8027" "8028" ...

The things you think are list indices are really in the 'dimnames'  
attributes of the objects.