geomorphR/geomorph

Negative values in tps files converted to NA

Closed this issue · 8 comments

My tps file has a block:

LM=23
1.784773 -6.711417 11.20273
2.813098 -6.843384 9.80391
2.927272 -5.375836 9.157258
1.902069 -5.258978 8.542417
1.985342 -6.27904 8.50721
1.685644 -5.387742 9.193977
2.792423 -7.149733 8.359506
2.598825 -7.740273 7.641532
4.846469 -8.898491 7.700092
5.83001 -10.3386 8.802572
13.33278 -12.14554 0.7303419
7.867355 -9.058348 5.730173
8.522495 -9.230215 6.731133
8.195727 -10.58067 7.066747
7.566654 -10.18632 6.090911
9.866902 -9.652846 3.924262
10.61931 -9.899772 5.087601
10.21485 -11.39175 5.733529
9.486016 -10.9182 4.521498
12.90555 -10.68164 3.426916
13.23247 -12.50423 1.514346
11.85793 -13.19174 2.430471
11.53669 -11.74882 1.191167
ID = C26 

which is converted by readland.tps() to

, , NA

           [,1] [,2]       [,3]
 [1,]  1.784773   NA 11.2027300
 [2,]  2.813098   NA  9.8039100
 [3,]  2.927272   NA  9.1572580
 [4,]  1.902069   NA  8.5424170
 [5,]  1.985342   NA  8.5072100
 [6,]  1.685644   NA  9.1939770
 [7,]  2.792423   NA  8.3595060
 [8,]  2.598825   NA  7.6415320
 [9,]  4.846469   NA  7.7000920
[10,]  5.830010   NA  8.8025720
[11,] 13.332780   NA  0.7303419
[12,]  7.867355   NA  5.7301730
[13,]  8.522495   NA  6.7311330
[14,]  8.195727   NA  7.0667470
[15,]  7.566654   NA  6.0909110
[16,]  9.866902   NA  3.9242620
[17,] 10.619310   NA  5.0876010
[18,] 10.214850   NA  5.7335290
[19,]  9.486016   NA  4.5214980
[20,] 12.905550   NA  3.4269160
[21,] 13.232470   NA  1.5143460
[22,] 11.857930   NA  2.4304710
[23,] 11.536690   NA  1.1911670

I'm using geomorph 3.0.6.

Here's my full sessionInfo().

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin17.5.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] geomorph_3.0.6    ape_5.1           rgl_0.99.16       wesanderson_0.3.6 cowplot_0.9.2     forcats_0.3.0    
 [7] stringr_1.3.0     dplyr_0.7.4       purrr_0.2.4       readr_1.1.1       tidyr_0.8.0       tibble_1.4.2     
[13] ggplot2_2.2.1     tidyverse_1.2.1   readxl_1.1.0      fortunes_1.5-4    devtools_1.13.5  

loaded via a namespace (and not attached):
 [1] subplex_1.5-4          Rcpp_0.12.16           mvtnorm_1.0-7          lubridate_1.7.4        lattice_0.20-35       
 [6] assertthat_0.2.0       digest_0.6.15          psych_1.8.4            mime_0.5               R6_2.2.2              
[11] cellranger_1.1.0       plyr_1.8.4             coda_0.19-1            httr_1.3.1             pillar_1.2.2          
[16] rlang_0.2.0            lazyeval_0.2.1         curl_3.2               rstudioapi_0.7         miniUI_0.1.1          
[21] Matrix_1.2-14          foreign_0.8-70         htmlwidgets_1.2        munsell_0.4.3          shiny_1.0.5           
[26] broom_0.4.4            geiger_2.0.6           compiler_3.5.0         httpuv_1.4.2           modelr_0.1.1          
[31] pkgconfig_2.0.1        mnormt_1.5-5           htmltools_0.3.6        crayon_1.3.4           withr_2.1.2           
[36] later_0.7.2            MASS_7.3-50            grid_3.5.0             nlme_3.1-137           jsonlite_1.5          
[41] xtable_1.8-2           gtable_0.2.0           git2r_0.21.0           magrittr_1.5           scales_0.5.0          
[46] cli_1.0.0              stringi_1.2.2          reshape2_1.4.3         promises_1.0.1         bindrcpp_0.2.2        
[51] xml2_1.2.0             deSolve_1.21           tools_3.5.0            manipulateWidget_0.9.0 glue_1.2.0            
[56] jpeg_0.1-8             hms_0.4.2              crosstalk_1.0.0        parallel_3.5.0         colorspace_1.3-2      
[61] rvest_0.3.2            memoise_1.1.0          knitr_1.20             bindr_0.1.1            haven_1.1.1           

Thanks. I had been using the "add a constant" workaround, which works fine.

Apologies for my ignorance, but how do you edit the TPS file prior to readland.tps to add a constant?
I've added a constant into that part of the code, but it still reads as NA values. Sorry - am new to this kind of data.

Thanks.

@antkal Hi,

Just updated and worked fine! As there were a lot of negative values I had to respond to the Negative landmark coordinates have been identified. Should they be considered as NAs? (y/n) lots of times, but wasn't too much of a faff. Thanks so much!

@antkal Working fine now - thanks!