geomorphR/geomorph

compare.evol.rates: Error in C[rownames(x), rownames(x)] : subscript out of bounds

juanmac17 opened this issue · 6 comments

I am trying to use compare.evol.rates function but i keep getting this error message. I check the input data type with the one provided as examples and see no difference.

Juan, It sounds like there may be an issue with your specimen names in your input array. Without further information on the data objects your are running the function with, I can't be sure. Please provide this.

Hi Emma, thx for replying so fast. I have a twelve taxa phylogenetic tree (I used read.tree and drop.tip functions) and a tps file with twelve configurations of 25 landmark. The ID of the tps match with the tip.labels of the tree.

I´ll send you information of the input data:

The tree call prunned

> prunned

Phylogenetic tree with 12 tips and 11 internal nodes.

Tip labels:
	uru1, uru2, neu6, neu2, sin1, sin2, ...

Rooted; includes branch lengths.

Procrustes coordinates:

> gpa$coords
, , uru1

              [,1]         [,2]
 [1,] -0.014883788  0.302994270
 [2,] -0.042942243  0.198536940
 [3,] -0.095284883  0.241169024
 [4,] -0.120021961  0.161931023
 [5,] -0.152289381  0.052026499
 [6,] -0.180429888  0.026058193
 [7,] -0.205598521 -0.116457242
 [8,] -0.182587635 -0.256411508
 [9,] -0.057261179 -0.215244021
[10,]  0.008027162 -0.200048510
[11,]  0.064287982 -0.214952529
[12,]  0.188964218 -0.244111250
[13,]  0.204993802 -0.102330702
[14,]  0.175152658  0.029744124
[15,]  0.148053432  0.053877861
[16,]  0.117864055  0.158628035
[17,]  0.092489501  0.238908449
[18,]  0.043144302  0.198408406
[19,] -0.056968347  0.007038989
[20,] -0.099200053 -0.048875534
[21,] -0.048095034 -0.099068849
[22,]  0.052766325 -0.096113602
[23,]  0.100335240 -0.047957450
[24,]  0.057070481  0.010093991
[25,]  0.002413753 -0.037844607

, , uru2

Group designation:

> land.gp
 uru1  uru2  neu6  neu2  sin1  sin2  sin4  sca5  sca4  sca7 sca13 sca14 
    1     1     1     2     1     1     2     1     1     1     1     1 
Levels: 1 2

The issue is coming from the internal function phylo.mat, that is calculating the phylogenetic covariance matrix from the tree. Specifically:

  C<-ape::vcv.phylo(phy,anc.nodes=FALSE) # phy is your tree (prunned)
  C<-C[rownames(x),rownames(x)] # x is a 2D array of the data (gpa$coords)

You can run that yourself, and you'll get the same error. Thus the issue is clearly a disconnect between the row names of x and the names in the tree. Double check those are the same using the function match

Thank you very much Emma and Mike. I have spaces everywhere!!