Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot.ppfst requires pop to be numeric #27

Closed
greavess opened this issue May 10, 2019 · 5 comments
Closed

boot.ppfst requires pop to be numeric #27

greavess opened this issue May 10, 2019 · 5 comments

Comments

@greavess
Copy link

boot.ppfst requires pop to be numeric, but genind does not, so a genind object is used that has populations defined as strings/factors, the loop on line 53 fails.

@jgx65
Copy link
Owner

jgx65 commented May 12, 2019

Could you send a reproducible example please? If I run

library(adegenet)
library(hierfstat)
data(nancycats)
head(genind2hierfstat(nancycats)
     pop   fca8  fca23  fca43  fca45  fca77  fca78  fca90  fca96  fca37
N215 P01     NA 136146 139139 116120 156156 142148 199199 113113 208208
N216 P01     NA 146146 139145 120126 156156 142148 185199 113113 208208
N217 P01 135143 136146 141141 116116 152156 142142 197197 113113 210210
N218 P01 133135 138138 139141 116126 150150 142148 199199  91105 208208
N219 P01 133135 140146 141145 126126 152152 142148 193199 113113 208208
N220 P01 135143 136146 145149 120126 150156 148148 193195  91113 208208
N221 P01 135135 136146 139145 116126 152152 142148 199199 105113 208208

the population identifier is a string/factor, and boot.ppfst works fine:

boot.ppfst(nancycats)
       Upper limit above diagonal 
       Lower limit below diagonal 
 
           P01        P02          P03        P04        P05          P06        P07         P08        P09        P10        P11         P12
P01         NA 0.16527107  0.138931515 0.10538269 0.12490134  0.135805323 0.10974452 0.090289064 0.15107119 0.09910882 0.08273717 0.112510816
P02 0.10018520         NA  0.162616654 0.12628190 0.17995957  0.133177481 0.14336474 0.096996575 0.18142051 0.12131568 0.12503822 0.211516133
P03 0.03093669 0.10009283           NA 0.04649229 0.07805931  0.052918281 0.14287233 0.093893782 0.14296213 0.14442911 0.04995630 0.160172988
P04 0.03131237 0.08732120 -0.003439957         NA 0.08110297  0.063456106 0.13101495 0.068087905 0.10074865 0.12614141 0.04393899 0.090055910
P05 0.03113876 0.08161213  0.044043195 0.01831515         NA  0.110121733 0.15597820 0.124840335 0.17878145 0.13685030 0.07701482 0.133884542
P06 0.04197534 0.06504035  0.001018079 0.01730374 0.04141901           NA 0.11920930 0.088539684 0.12662163 0.12467349 0.05937641 0.186748424
P07 0.04148567 0.05994116  0.056773471 0.03946985 0.07979195  0.033557709         NA 0.075623582 0.20555964 0.13102749 0.12446138 0.122459616
P08 0.01810493 0.05900986  0.026492998 0.01033574 0.04844017  0.015022737 0.01586866          NA 0.15533393 0.09578876 0.08141853 0.146357937
P09 0.08070396 0.06583038  0.061512009 0.03457463 0.07471795  0.064332127 0.06156084 0.054636834         NA 0.15805690 0.08958808 0.157192354
P10 0.02801927 0.03365126  0.048444104 0.06571775 0.05774847  0.035853898 0.07097754 0.006205084 0.04678074         NA 0.06885966 0.188660265
P11 0.02037655 0.06599257 -0.002440197 0.01015449 0.03707135 -0.004179104 0.02739575 0.011992478 0.02143865 0.02826966         NA 0.129667990
P12 0.04428948 0.06189554  0.029101920 0.02866665 0.04352742  0.017742883 0.02876499 0.028334792 0.02949657 0.05604561 0.03018727          NA
P13 0.04819222 0.09194682  0.061683994 0.06056744 0.09075764  0.045719249 0.08323444 0.050181380 0.09953310 0.06080105 0.05865958 0.035525438
P14 0.03750093 0.07682647  0.008450818 0.01113399 0.03365295  0.029239912 0.07130308 0.022892319 0.04206170 0.05904242 0.01794082 0.024547841
P15 0.02860687 0.06290179  0.020211885 0.01731131 0.06406166  0.039238117 0.06151640 0.011419169 0.04219912 0.02577080 0.01973952 0.043684503
P16 0.08378905 0.08799260  0.067436573 0.05856744 0.05650553  0.039251229 0.09626792 0.068397976 0.04595328 0.05909382 0.04652249 0.061182509
P17 0.01639007 0.06707832  0.035337238 0.03910325 0.03622594  0.042709960 0.05760834 0.050289531 0.06247788 0.03240155 0.02600876 0.008719171
           P13        P14        P15        P16        P17
P01 0.15281951 0.12325744 0.11546619 0.16390484 0.11468217
P02 0.18567098 0.14118058 0.11495965 0.14099668 0.21308024
P03 0.15491730 0.08945354 0.10335937 0.13325773 0.14824540
P04 0.13103081 0.07714832 0.08874031 0.09407607 0.09600192
P05 0.14134982 0.13383556 0.13834305 0.14206541 0.09546411
P06 0.13104795 0.08685318 0.13144625 0.07534583 0.20885807
P07 0.17976052 0.13664350 0.15870221 0.16825222 0.11934452
P08 0.15513985 0.07628524 0.07397964 0.12856507 0.15798163
P09 0.20073482 0.11170838 0.11722660 0.13272597 0.16961031
P10 0.17914058 0.12397091 0.08019687 0.15823145 0.17364183
P11 0.13035249 0.06918714 0.09943097 0.08394306 0.09539192
P12 0.22161286 0.13107083 0.20305881 0.21063258 0.10784416
P13         NA 0.13691429 0.16107318 0.17145858 0.19193967
P14 0.06969726         NA 0.09436296 0.10749864 0.14098228
P15 0.04405474 0.03107611         NA 0.13661227 0.17660509
P16 0.06767924 0.05595294 0.05173505         NA 0.22675691
P17 0.05013389 0.03111027 0.02950697 0.06356410         NA

@greavess
Copy link
Author

Hmm, when I run the exact same code, I get
Error in i + 1 : non-numeric argument to binary operator
My packages are up to date (adegenet 2.1.1, hierfstat 0.04-22), and I ran it in a fresh workspace.
Must be something specific to my install though.

@jgx65
Copy link
Owner

jgx65 commented May 12, 2019

Current hierfstat version from github is 0.04-30, yours is outdated. Here is my session info:

 sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Switzerland.1252  LC_CTYPE=English_Switzerland.1252    LC_MONETARY=English_Switzerland.1252
[4] LC_NUMERIC=C                         LC_TIME=English_Switzerland.1252    

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

other attached packages:
[1] adegenet_2.1.1    ade4_1.7-13       hierfstat_0.04-30

loaded via a namespace (and not attached):
 [1] gtools_3.8.1      tidyselect_0.2.5  reshape2_1.4.3    purrr_0.2.5       splines_3.5.1     lattice_0.20-35   colorspace_1.4-0  expm_0.999-3     
 [9] htmltools_0.3.6   mgcv_1.8-24       yaml_2.2.0        rlang_0.3.1       pillar_1.3.1      later_0.7.5       glue_1.3.0        sp_1.3-1         
[17] bindrcpp_0.2.2    bindr_0.1.1       plyr_1.8.4        stringr_1.3.1     munsell_0.5.0     gtable_0.2.0      coda_0.19-2       permute_0.9-4    
[25] httpuv_1.4.5.1    parallel_3.5.1    spdep_0.8-1       Rcpp_1.0.0        xtable_1.8-3      scales_1.0.0      promises_1.0.1    gdata_2.18.0     
[33] vegan_2.5-3       mime_0.6          deldir_0.1-16     ggplot2_3.1.0     digest_0.6.18     stringi_1.2.4     gmodels_2.18.1    dplyr_0.7.8      
[41] shiny_1.2.0       grid_3.5.1        tools_3.5.1       LearnBayes_2.15.1 magrittr_1.5      lazyeval_0.2.1    tibble_2.0.1      cluster_2.0.7-1  
[49] crayon_1.3.4      ape_5.2           seqinr_3.4-5      pkgconfig_2.0.2   MASS_7.3-50       Matrix_1.2-14     spData_0.3.0      assertthat_0.2.0 
[57] rstudioapi_0.8    R6_2.3.0          boot_1.3-20       igraph_1.2.2      nlme_3.1-137      compiler_3.5.1   

@greavess
Copy link
Author

Ah the version on CRAN is 0.04-22, so you must have fixed it already. I will get the github version. My R session is practically identical.

@jgx65
Copy link
Owner

jgx65 commented May 12, 2019

Yes, as pushing packages to CRAN require more checking, github is often ahead of CRAN. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants