HenrikBengtsson / matrixStats

R package: Methods that Apply to Rows and Columns of Matrices (and to Vectors)
https://cran.r-project.org/package=matrixStats
206 stars 34 forks source link

NOTES: Error in .make_numeric_version() #250

Closed HenrikBengtsson closed 7 months ago

HenrikBengtsson commented 7 months ago

The following is error appears with recent R-devel versions:

* creating vignettes ... ERROR
Error: --- re-building ‘matrixStats-methods.md.rsp’ using rsp
--- finished re-building ‘matrixStats-methods.md.rsp’
"/opt/R/devel/lib/R/bin/Rscript" -e "if (getRversion() < 3) R.rsp::buildNonSweaveVignettes()"
Error in .make_numeric_version(x, strict, .standard_regexps()$valid_numeric_version) : 
  invalid non-character version specification 'x' (type: double)
Calls: Ops.numeric_version ... as.numeric_version -> numeric_version -> .make_numeric_version
Execution halted
make: *** [Makefile:10: vignettes] Error 1
Error in tools::buildVignettes(dir = ".", tangle = TRUE) : 
  running 'make' failed
In addition: Warning message:
In tools::buildVignettes(dir = ".", tangle = TRUE) :
  Files named as vignettes but with no recognized vignette engine:
   ‘vignettes/dummy.Rnw’
(Is a VignetteBuilder field missing?)
Execution halted

My guess is it that it's something that should be fixed in R.rsp, but I'm jotting this down here since this is where we discovered it first.

See also R-devel thread '[Rd] Question regarding .make_numeric_version with non-character input' on 2024-03-29, cf. https://stat.ethz.ch/pipermail/r-devel/2024-March/083297.html.

HenrikBengtsson commented 7 months ago

Yeah, it's introduced in R (>= 4.4) and happens during R CMD build (and I guess not with R CMD check). Specifically,

https://github.com/wch/r-source/blob/1da13b4a9a9e5ffed1fc684320414a93476b083f/src/library/base/R/version.R#L52-L56

So, the solution is to replace getVersion() < 3 with getVersion() < "3".