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

Explicitly specify argument 'tied.method' when calling matrixStats::colRanks() #1

Open
HenrikBengtsson opened this issue Apr 10, 2024 · 0 comments

Comments

@HenrikBengtsson
Copy link

HenrikBengtsson commented Apr 10, 2024

TL;DR

Whenever calling colRanks() or rowRanks() from matrixStats, please specify argument ties.method explicitly. In future releases of matrixStats, it will be an error if not doing so.

We will roll out this change slowly. First users of your package will see warnings, which are non-breaking. Only in a later release, matrixStats will produce errors, which then are breaking.

To be ahead of this, please update your package to explicitly specify the ties.method.

Background

The matrixStats package will eventually require that argument ties.method of colRanks() and rowRanks() is explicitly specified. Relying on the default value will become deprecated, and eventually also defunct. For example, instead of calling colRanks(X), one could specify colRanks(X, ties.method = "max") or colRanks(X, ties.method = "average").

The reason for this is that the default ties.method value for colRanks() and rowRanks() is currently ties.method = "max", whereas the corresponding one for base::rank() is ties.method = "average". We want the matrixStats functions to eventually also default to ties.method = "average". In order to do so, we cannot just switch from one version to the other, because that would change the result. You can read about this in HenrikBengtsson/matrixStats#142.

This is why we are reaching out to you, so you can make sure to use the ties.method that you intended. When scanning packages that use colRanks() and rowRanks() of matrixStats without specifying the ties.method argument, your package came up. See below for details.

Details

We ran reverse-package dependency checks (R CMD check) with environment variable R_MATRIXSTATS_TIES_METHOD_MISSING=defunct to detect with missing ties.method argument. You package came up with the following.

* using log directory ‘/c4/home/henrik/repositories/matrixStats/revdep/checks/LDM/new/LDM.Rcheck’
* using R version 4.3.3 (2024-02-29)
* using platform: x86_64-pc-linux-gnu (64-bit)
* R was compiled by
    gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
    GNU Fortran (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
* running under: CentOS Linux 7 (Core)
* using session charset: UTF-8
* using option ‘--no-manual’
* checking for file ‘LDM/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘LDM’ version ‘6.0.1’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘LDM’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking LazyData ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking sizes of PDF files under ‘inst/doc’ ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... ERROR
Running examples in ‘LDM-Ex.R’ failed
The error most likely occurred in:

> ### Name: ldm
> ### Title: Testing hypotheses about the microbiome using a linear
> ###   decomposition model (LDM)
> ### Aliases: ldm
> ### Keywords: microbiome
> 
> ### ** Examples
> 
> res.ldm <- ldm(formula=throat.otu.tab5 | (Sex+AntibioticUse) ~ SmokingStatus+PackYears, 
+               data=throat.meta, seed=67817, fdr.nominal=0.1, n.perm.max=1000, n.cores=1, 
+               verbose=FALSE) 
Error: [matrixStats] Please explicitly specify argument 'ties.method' when calling colRanks() and rowRanks() of matrixStats. This is because the current default ties.method="max" will eventually be updated to ties.method="average" in order to align with the default of base::rank()
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... ERROR
  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > test_check("LDM")
  Loading required package: LDM
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ldm.R:10:5'): `ldm` function provides expected results ─────────
  <defunctError/error/condition>
  Error: [matrixStats] Please explicitly specify argument 'ties.method' when calling colRanks() and rowRanks() of matrixStats. This is because the current default ties.method="max" will eventually be updated to ties.method="average" in order to align with the default of base::rank()
  Backtrace:
      ▆
   1. └─LDM::ldm(...) at test-ldm.R:10:5
   2.   ├─base::array(colRanks(mat), c(n.var1, n.otu.smallp, n.perm.completed))
   3.   └─matrixStats::colRanks(mat)
   4.     └─matrixStats:::tiesMethodMissing()
   5.       └─base (local) action(...)
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 1 ]
  Error: Test failures
  Execution halted
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... NONE
  ‘LDM.pdf.asis’ using ‘UTF-8’... OK
* checking re-building of vignette outputs ... OK
* DONE
Status: 2 ERRORs
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

1 participant