grunwaldlab / poppr

🌶 An R package for genetic analysis of populations with mixed (clonal/sexual) reproduction
https://grunwaldlab.github.io/poppr
68 stars 26 forks source link

R 4.0.0 will change behavior of poppr() #212

Closed zkamvar closed 4 years ago

zkamvar commented 4 years ago

This is entirely related to https://github.com/reconhub/matchmaker/issues/9, but slightly different.

 Current CRAN status: ERROR: 2, OK: 11

Version: 2.8.4
Check: tests
Result: ERROR
     Running 'test-all.R' [18s/19s]
    Running the tests in 'tests/test-all.R' failed.
    Complete output:
     > library(testthat)
     > options(poppr.debug = TRUE)
     > test_check("poppr")
     Loading required package: poppr
     Loading required package: adegenet
     Loading required package: ade4

     /// adegenet 2.1.2 is loaded ////////////

     > overview: '?adegenet'
     > tutorials/doc/questions: 'adegenetWeb()'
     > bug reports/feature requests: adegenetIssues()

     This is poppr version 2.8.4. To get started, type package?poppr
     OMP parallel support: available
     -- 1. Failure: poppr returns expected PA values (@test-poppr.R#52) ------------
     `x` not equivalent to `expected`.
     Types not compatible: character is not integer

     -- 2. Failure: poppr returns expected codominant values (@test-poppr.R#66) ----
     `x` not equivalent to `expected`.
     Types not compatible: character is not integer

     == testthat results ===========================================================
     [ OK: 333 | SKIPPED: 187 | WARNINGS: 0 | FAILED: 2 ]
     1. Failure: poppr returns expected PA values (@test-poppr.R#52)
     2. Failure: poppr returns expected codominant values (@test-poppr.R#66)

     Error: testthat unit tests failed
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 2.8.4
Check: whether package can be installed
Result: ERROR
    Installation failed.
Flavor: r-release-windows-ix86+x86_64 

The issue is due to the fact that Zhian from 2012-2016 did not think to set stringsAsFactors = FALSE when constructing the poppr table and here we are.

The solution to this is unlike that of https://github.com/reconhub/matchmaker/issues/9 where we can simply update the tests, it's explicitly changing the output. The question then becomes stringsAsFactors = TRUE or stringsAsFactors = FALSE? The former gives backwards compatibility, but is not reproducible (see stringsAsFactors = HELLNO) while the latter moves forward with the times, but breaks backwards compatibility to a small degree. I'm leaning towards stringsAsFactors = FALSE.