geomorphR/geomorph

readland.tps only converts one set of negative landmark coords to NA

Closed this issue · 2 comments

Hello!

I have this weird issue with geomorph 3.2.0. When using readland.tps with negNA = True, if the specimen has more than one missing landmark, the function only converts the first set of missing coords the NA.

Example tpsdata:

LM=6
2854.00000 2968.00000
-1.00000 -1.00000
-1.00000 -1.00000
2400.00000 2854.00000
2267.00000 1937.00000
2968.00000 1091.00000
IMAGE=ANT_30.jpg
ID=ANT_30
SCALE=0.000935

After importing with readland.tps:

         [,1]      [,2]
[1,]  2.668490  2.775080
[2,]        NA        NA
[3,] -0.000935 -0.000935
[4,]  2.244000  2.668490
[5,]  2.119645  1.811095
[6,]  2.775080  1.020085

In fact my tps file contains 30 specimens, not a single one. I've only posted one of the specimens with missing landmarks to here. 3 out of 30 specimens has 2 missing landmarks and only the first missing landmark in these specimens are converted to NA's.

Development branch returns an error for the same tps file:

test <- readland.tps(file = "ANT.TPS", specID = "ID", negNA = TRUE)
Error in lm.nas[[which(ind.nas == i)]] : subscript out of bounds