tdjames1 / compadreDB

Code and data for the COMPADRE Plant Matrix Database and COMADRE Animal Matrix Database
GNU General Public License v2.0
0 stars 0 forks source link

rearrangeMatrix() fails when matF contains NA #7

Open tdjames1 opened 7 years ago

tdjames1 commented 7 years ago

Example from Bernt-Erik Sæther, Øvind Bakke. 2000. Life history variation and contribution of different demographic traits to the population growth rate in birds: a comparative approach. Ecology 81: 642-653.

 saetherMatrices$`Diomedea exulans`
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
 [1,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00    NA
 [2,] 0.92 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [3,] 0.00 0.92 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [4,] 0.00 0.00 0.92 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [5,] 0.00 0.00 0.00 0.92 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [6,] 0.00 0.00 0.00 0.00 0.92 0.00 0.00 0.00 0.00  0.00  0.00
 [7,] 0.00 0.00 0.00 0.00 0.00 0.92 0.00 0.00 0.00  0.00  0.00
 [8,] 0.00 0.00 0.00 0.00 0.00 0.00 0.92 0.00 0.00  0.00  0.00
 [9,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.92 0.00  0.00  0.00
[10,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.92  0.00  0.00
[11,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.92  0.92

Decomposed using values above the diagonal as the fecundity matrix, remaining values as growth/transition.

[1] "Species:  Diomedea exulans"
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
 [1,]    0    0    0    0    0    0    0    0    0     0    NA
 [2,]    0    0    0    0    0    0    0    0    0     0     0
 [3,]    0    0    0    0    0    0    0    0    0     0     0
 [4,]    0    0    0    0    0    0    0    0    0     0     0
 [5,]    0    0    0    0    0    0    0    0    0     0     0
 [6,]    0    0    0    0    0    0    0    0    0     0     0
 [7,]    0    0    0    0    0    0    0    0    0     0     0
 [8,]    0    0    0    0    0    0    0    0    0     0     0
 [9,]    0    0    0    0    0    0    0    0    0     0     0
[10,]    0    0    0    0    0    0    0    0    0     0     0
[11,]    0    0    0    0    0    0    0    0    0     0     0
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
 [1,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [2,] 0.92 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [3,] 0.00 0.92 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [4,] 0.00 0.00 0.92 0.00 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [5,] 0.00 0.00 0.00 0.92 0.00 0.00 0.00 0.00 0.00  0.00  0.00
 [6,] 0.00 0.00 0.00 0.00 0.92 0.00 0.00 0.00 0.00  0.00  0.00
 [7,] 0.00 0.00 0.00 0.00 0.00 0.92 0.00 0.00 0.00  0.00  0.00
 [8,] 0.00 0.00 0.00 0.00 0.00 0.00 0.92 0.00 0.00  0.00  0.00
 [9,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.92 0.00  0.00  0.00
[10,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.92  0.00  0.00
[11,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00  0.92  0.92
Error in Rep[1]:Rep[length(Rep)] : argument of length 0